Skip to content

Instantly share code, notes, and snippets.

@onionmk2
Last active February 19, 2017 23:58
Show Gist options
  • Select an option

  • Save onionmk2/46fbb6ff816fa51d6cbe86c767d0d948 to your computer and use it in GitHub Desktop.

Select an option

Save onionmk2/46fbb6ff816fa51d6cbe86c767d0d948 to your computer and use it in GitHub Desktop.
var dic = new Dictionary<string, int>
{
{"Level_01", 1},
{"Level_02", 2},
{"Level_03", 3},
{"Level_04", 3}
}
;
var x= dic.Select(kvp => new KeyValuePair<int, string>(kvp.Value, kvp.Key));
var y = dic.ToLookup(pair => pair.Value, pair => pair.Key);
new List<object>{x, y}.ForEach(result => result.Dump());
@onionmk2
Copy link
Copy Markdown
Author

kvp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment