Say we have a dictionary: Dict('a' => 2, 'b' => 3, 'c' => 2, 'd' => 4, 'e' => 2)
I used:
var items = from pair in Dict orderby pair.Value descending select pair;
Everything is in order, and the output is:
d: 4
b: 3
c: 2
e: 2
a: 2
Now I want to sort the keys with the same value in alphabetical order to get:
d: 4
b: 3
a: 2
c: 2
e: 2
But I have no idea how to do this.
Any ideas?
source
share