By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,417 Members | 1,263 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,417 IT Pros & Developers. It's quick & easy.

List of strings from dictionary

P: 1
Hi, I'm really struggling with creating a list that takes the keys from a dictionary and puts them into a list.

I know i need set up a variable for the list to return, then use a loop, transfer each key into the list.
Then return the list.

Please Help!

**IM using visual Basic!**
Nov 27 '13 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 9,731
You should be able to use the Dictionary's Keys Property to retrieve the keys and put them into a list...

You can take advantage of the List's Constructor that takes an IEnumerable parameter to populate the list with the items you already have.

For example:
Expand|Select|Wrap|Line Numbers
  1. Dim theKeys As New List(Of String)(myDictionary.Keys)
Dec 2 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.