Add Method

ImmutableSortedDictionary<TKey, TValue>.Add Method (TKey, TValue)


Adds an element with the specified key and value to the immutable sorted dictionary.

Namespace:   System.Collections.Immutable
Assembly:  System.Collections.Immutable (in System.Collections.Immutable.dll)

public ImmutableSortedDictionary<TKey, TValue> Add(
	TKey key,
	TValue value


Type: TKey

The key of the entry to add.

Type: TValue

The value of entry to add.

Return Value

Type: System.Collections.Immutable.ImmutableSortedDictionary<TKeyTValue>

A new immutable sorted dictionary that contains the additional key/value pair.

Exception Condition

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.

Return to top
© 2015 Microsoft