How do I sort a keyvalue pair with descending order of their values?
foreach (KeyValuePair item in keyvalue.OrderBy(key => key.Value))
Use OrderByDescending instead of OrderBy.
OrderByDescending
OrderBy
foreach (var item in keyvalue.OrderByDescending(key => key.Value)) { }