Question
LINQ transform Dictionary<key,value> to Dictionary<value,key>
I'm having a low-brainwave day... Does anyone know of a quick & elegant way to transform a Dictionary so that the key becomes the value and vice-versa?
Example:
var originalDictionary = new Dictionary<int, string>() {
{1, "One"}, {2, "Two"}, {3, "Three"}
};
becomes
var newDictionary = new Dictionary<string, int>();
// contents:
// {
// {"One", 1}, {"Two", 2}, {"Three", 3}
// };
45 29223
45