Saturday, October 22, 2011

Sort a Dictionary

This shows how to sort a Dictionary like so:

var sortedDict = (from entry in myDict orderby entry.Value ascending select entry).ToDictionary(pair => pair.Key, pair => pair.Value);

No comments:

Post a Comment