Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

dictionary to list c#

Dictionary<string, string> dicNumber = new Dictionary<string, string>();
List<string> listNumber = new List<string>();

dicNumber.Add("1", "First");
dicNumber.Add("2", "Second");
dicNumber.Add("3", "Third");

listNumber = dicNumber.Select(kvp => kvp.Key).ToList();
// Or:
listNumber = dicNumber.Keys.ToList();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #dictionary #list
ADD COMMENT
Topic
Name
6+1 =