ImmutableDictionary<TKey, TValue>::Add Method (TKey, TValue)
Adds an element with the specified key and value to the immutable dictionary.
Assembly: System.Collections.Immutable (in System.Collections.Immutable.dll)
Parameters
- key
-
Type:
TKey
The key of the element to add.
- value
-
Type:
TValue
The value of the element to add.
Return Value
Type: System.Collections.Immutable::ImmutableDictionary<TKey, TValue>^A new immutable dictionary that contains the additional key/value pair.
| Exception | Condition |
|---|---|
| ArgumentException | The given key already exists in the dictionary but has a different value. |
If the given key/value pair already exists in the dictionary, the existing instance of the dictionary is returned.
Show: