How do you sort a C# dictionary by value?
Posted
by kurious
on Stack Overflow
See other posts from Stack Overflow
or by kurious
Published on 2008-08-02T00:40:58Z
Indexed on
2010/03/22
9:01 UTC
Read the original article
Hit count: 343
I often have a Dictionary of keys & values and need to sort it by value. For example, I have a hash of words and their frequencies, and want to order them by frequency.
There's SortedList which is good for a single value (frequency), but I want to map it back to the word.
SortedDictionary orders by key, not value. Some resort to a custom class, but what's the cleanest way?
© Stack Overflow or respective owner