Suppose we have a
var dictionary= new Dictionary<int, IList<int>>();
What I want is to ouput a sorted version of it, ordered first by keys and then by values inside a list.
E.g.
1 2, 1, 6
5 2, 1
2 1, 3
Becomes
1 1, 2, 6
2 1, 3
5 1, 2
I tried doing it inside foreach
, but obviously this is a bad idea to change the thing you are iterating.