I have a Dictionary <string, string> where the value is a concatenation of substrings delimited with a :. For example, 123:456:Bob:Smith.
I would like to order the dictionary by the last substring (Smith) ascending, and preferably like this:
orderedDictionary = unordered
.OrderBy(x => x.Value)
.ToDictionary(x => x.Key, x => x.Value);
So, I need to somehow treat the x.Value as a string and sort by extracting the fourth substring. Any ideas?
1 Answer