Code: Select all
var d = new ImmutableDictionary { { "a", 1 }, { "b", 2 } };
< /code>
(mithilfe von ImmutableDictionary < /code> von System.collections.immable). Es scheint eine einfache Verwendung zu sein, da ich alle Werte im Voraus deklariere - keine Mutation dort. Dies gibt mir jedoch einen Fehler: < /p>
Der Typ 'System.Collections.Immutable.ImmutableDictionary
Wie soll ich ein neues unveränderliches Wörterbuch mit statischer Inhalt erstellen?