Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ImmutableDictionary<TKey, TValue>.SetItem Method

Sets the specified key and value in the immutable dictionary, possibly overwriting an existing value for the key.

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

public ImmutableDictionary<TKey, TValue> SetItem(
	TKey key,
	TValue value


Type: TKey

The key of the entry to add.

Type: TValue

The key value to set.

Return Value

Type: System.Collections.Immutable.ImmutableDictionary<TKey, TValue>
A new immutable dictionary that contains the specified key/value pair.

If the specified key/value pair already exists in the dictionary, this method returns the existing instance of the dictionary. If the key already exists but has a different value, this method returns a new instance of the dictionary with the overwritten value.

© 2015 Microsoft