DDiVita
DDiVita

Reputation: 4265

Sorting a Dictionary<string,Dictionary<string,string>> by the value of the inner Dictionary value using LINQ?

I can't seem to wrap my head around this one. I need to sort a Dictionary by the value of an inner Dictionary using LINQ. Any thoughts?

Upvotes: 2

Views: 777

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1064204

Do you mean you want all values, sorted by the inner value?

from outerPair in outer
from innerPair in outerPair.Value
orderby innerPair.Value
select new {
    OuterKey = outerPair.Key,
    InnerKey = innerPair.Key,
    Value = innerPair.Value
};

Upvotes: 2

Related Questions