Wie konvertiere ich ein Wörterbuch in ein Nachschlagen? [Duplikat]
Diese Frage hat hier bereits eine Antwort:
LINQ Convert Dictionary to Lookup 2 AntwortenIch habe ein Wörterbuch mit einer Signatur:Dictionary<int, List<string>>
. Ich möchte es in ein Lookup mit einer Signatur konvertieren:Lookup<int, string>
.
Ich habe es versucht:
<code>Lookup<int, string> loginGroups = mapADToRole.ToLookup(ad => ad.Value, ad => ad.Key); </code>
Das funktioniert aber nicht so gut.