Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

how to sort a dictionary by value in c#

Dictionary<string, int> myDict = new Dictionary<string, int>();
myDict.Add("one", 1);
myDict.Add("four", 4);
myDict.Add("two", 2);
myDict.Add("three", 3);

var sortedDict = from entry in myDict orderby entry.Value ascending select entry;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sort #dictionary
ADD COMMENT
Topic
Name
3+7 =