Inverter chaves e valores

Published by SyntaxGardener in

Retorne um novo dicionário com as chaves e os valores trocados. Os valores de entrada são únicos.

Exemplos

Program.Invert(new Dictionary<string, string> { ["z"] = "q", ["w"] = "f" }) ➞ new Dictionary<string, string> { ["q"] = "z", ["f"] = "w" }

Program.Invert(new Dictionary<string, int> { ["a"] = 1, ["b"] = 2 }) ➞ new Dictionary<int, string> { [1] = "a", [2] = "b" }