Reverse a dictionary
·1 min
Have you ever wished your dictionary of <K,V> was in fact of <V,K>? I might be the last person to figure this out, but with LINQ (and a couple lambdas) you can do this with one magical line of code:
var newDict = oldDict.ToDictionary(l => l.Value, l => l.Key);
Neat, eh?