ImmutableDictionary(TKey, TValue) Class

ImmutableDictionary<'TKey, 'TValue> Class

 

Represents an immutable, unordered collection of keys and values.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

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

System.Object
  System.Collections.Immutable.ImmutableDictionary<'TKey, 'TValue>

[<Sealed>]
[<DefaultMemberAttribute("Item")>]
[<DebuggerDisplayAttribute("Count = {Count}")>]
type ImmutableDictionary<'TKey, 'TValue> = 
    class
        interface IImmutableDictionary<'TKey, 'TValue>
        interface IReadOnlyDictionary<'TKey, 'TValue>
        interface IReadOnlyCollection<KeyValuePair<'TKey, 'TValue>>
        interface IDictionary<'TKey, 'TValue>
        interface ICollection<KeyValuePair<'TKey, 'TValue>>
        interface IEnumerable<KeyValuePair<'TKey, 'TValue>>
        interface IDictionary
        interface ICollection
        interface IEnumerable
    end

Type Parameters

TKey

The type of the keys in the dictionary.

TValue

The type of the values in the dictionary.

NameDescription
System_CAPS_pubpropertyCount

Gets the number of key/value pairs in the immutable dictionary.

System_CAPS_pubpropertyIsEmpty

Gets a value that indicates whether this instance of the immutable dictionary is empty.

System_CAPS_pubpropertyItem('TKey)

Gets the TValue associated with the specified key.

System_CAPS_pubpropertyKeyComparer

Gets the key comparer for the immutable dictionary.

System_CAPS_pubpropertyKeys

Gets the keys in the immutable dictionary.

System_CAPS_pubpropertyValueComparer

Gets the value comparer used to determine whether values are equal.

System_CAPS_pubpropertyValues

Gets the values in the immutable dictionary.

NameDescription
System_CAPS_pubmethodAdd('TKey, 'TValue)

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

System_CAPS_pubmethodAddRange(IEnumerable<KeyValuePair<'TKey, 'TValue>>)

Adds the specified key/value pairs to the immutable dictionary.

System_CAPS_pubmethodClear()

Retrieves an empty immutable dictionary that has the same ordering and key/value comparison rules as this dictionary instance.

System_CAPS_pubmethodContains(KeyValuePair<'TKey, 'TValue>)

Determines whether this immutable dictionary contains the specified key/value pair.

System_CAPS_pubmethodContainsKey('TKey)

Determines whether the immutable dictionary contains an element with the specified key.

System_CAPS_pubmethodContainsValue('TValue)

Determines whether the immutable dictionary contains an element with the specified value.

System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_pubmethodGetEnumerator()

Returns an enumerator that iterates through the immutable dictionary.

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodRemove('TKey)

Removes the element with the specified key from the immutable dictionary.

System_CAPS_pubmethodRemoveRange(IEnumerable<'TKey>)

Removes the elements with the specified keys from the immutable dictionary.

System_CAPS_pubmethodSetItem('TKey, 'TValue)

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

System_CAPS_pubmethodSetItems(IEnumerable<KeyValuePair<'TKey, 'TValue>>)

Sets the specified key/value pairs in the immutable dictionary, possibly overwriting existing values for the keys.

System_CAPS_pubmethodToBuilder()

Creates an immutable dictionary with the same contents as this dictionary that can be efficiently mutated across multiple operations by using standard mutable interfaces.

System_CAPS_pubmethodToString()

(Inherited from Object.)

System_CAPS_pubmethodTryGetKey('TKey, 'TKey)

Determines whether this dictionary contains a specified key.

System_CAPS_pubmethodTryGetValue('TKey, 'TValue)

Gets the value associated with the specified key.

System_CAPS_pubmethodWithComparers(IEqualityComparer<'TKey>)

Gets an instance of the immutable dictionary that uses the specified key comparer.

System_CAPS_pubmethodWithComparers(IEqualityComparer<'TKey>, IEqualityComparer<'TValue>)

Gets an instance of the immutable dictionary that uses the specified key and value comparers.

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticEmpty

Gets an empty immutable dictionary

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodICollection<KeyValuePair<'TKey, 'TValue>>.Add(KeyValuePair<'TKey, 'TValue>)

System_CAPS_pubinterfaceSystem_CAPS_privmethodICollection<KeyValuePair<'TKey, 'TValue>>.Clear()

System_CAPS_pubinterfaceSystem_CAPS_privmethodICollection<KeyValuePair<'TKey, 'TValue>>.CopyTo(KeyValuePair<'TKey, 'TValue>[], Int32)

System_CAPS_pubinterfaceSystem_CAPS_privmethodICollection<KeyValuePair<'TKey, 'TValue>>.Remove(KeyValuePair<'TKey, 'TValue>)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDictionary<'TKey, 'TValue>.Add('TKey, 'TValue)

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

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDictionary<'TKey, 'TValue>.Remove('TKey)

Removes the element with the specified key from the immutable dictionary.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIEnumerable<KeyValuePair<'TKey, 'TValue>>.GetEnumerator()

System_CAPS_pubinterfaceSystem_CAPS_privmethodICollection.CopyTo(Array, Int32)

Copies the elements of the dictionary to an array, starting at a particular array index.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDictionary.Add(Object, Object)

Adds an element with the provided key and value to the immutable dictionary object.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDictionary.Clear()

Clears this instance.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDictionary.Contains(Object)

Determines whether the immutable dictionary object contains an element with the specified key.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDictionary.GetEnumerator()

Returns an IDictionaryEnumerator object for the immutable dictionary object.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDictionary.Remove(Object)

Removes the element with the specified key from the immutable dictionary object.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIImmutableDictionary<'TKey, 'TValue>.Add('TKey, 'TValue)

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

System_CAPS_pubinterfaceSystem_CAPS_privmethodIImmutableDictionary<'TKey, 'TValue>.AddRange(IEnumerable<KeyValuePair<'TKey, 'TValue>>)

Adds the specified key/value pairs to the immutable dictionary.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIImmutableDictionary<'TKey, 'TValue>.Clear()

Retrieves an empty dictionary that has the same ordering and key/value comparison rules as this dictionary instance.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIImmutableDictionary<'TKey, 'TValue>.Remove('TKey)

Removes the element with the specified key from the immutable dictionary.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIImmutableDictionary<'TKey, 'TValue>.RemoveRange(IEnumerable<'TKey>)

Removes the elements with the specified keys from the immutable dictionary.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIImmutableDictionary<'TKey, 'TValue>.SetItem('TKey, 'TValue)

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

System_CAPS_pubinterfaceSystem_CAPS_privmethodIImmutableDictionary<'TKey, 'TValue>.SetItems(IEnumerable<KeyValuePair<'TKey, 'TValue>>)

Sets the specified key/value pairs in the immutable dictionary, possibly overwriting existing values for the keys.

NameDescription
System_CAPS_pubmethodToImmutableArray<KeyValuePair<'TKey, 'TValue>>()

Creates an immutable array from the specified collection.(Defined by ImmutableArray.)

System_CAPS_pubmethodToImmutableDictionary<KeyValuePair<'TKey, 'TValue>, 'TKey>(Func<KeyValuePair<'TKey, 'TValue>, 'TKey>)

Overloaded. Constructs an immutable dictionary from an existing collection of elements, applying a transformation function to the source keys.(Defined by ImmutableDictionary.)

System_CAPS_pubmethodToImmutableDictionary<KeyValuePair<'TKey, 'TValue>, 'TKey>(Func<KeyValuePair<'TKey, 'TValue>, 'TKey>, IEqualityComparer<'TKey>)

Overloaded. Constructs an immutable dictionary based on some transformation of a sequence.(Defined by ImmutableDictionary.)

System_CAPS_pubmethodToImmutableDictionary<KeyValuePair<'TKey, 'TValue>, 'TKey, 'TValue>(Func<KeyValuePair<'TKey, 'TValue>, 'TKey>, Func<KeyValuePair<'TKey, 'TValue>, 'TValue>)

Overloaded. Enumerates and transforms a sequence, and produces an immutable dictionary of its contents.(Defined by ImmutableDictionary.)

System_CAPS_pubmethodToImmutableDictionary<KeyValuePair<'TKey, 'TValue>, 'TKey, 'TValue>(Func<KeyValuePair<'TKey, 'TValue>, 'TKey>, Func<KeyValuePair<'TKey, 'TValue>, 'TValue>, IEqualityComparer<'TKey>)

Overloaded. Enumerates and transforms a sequence, and produces an immutable dictionary of its contents by using the specified key comparer.(Defined by ImmutableDictionary.)

System_CAPS_pubmethodToImmutableDictionary<KeyValuePair<'TKey, 'TValue>, 'TKey, 'TValue>(Func<KeyValuePair<'TKey, 'TValue>, 'TKey>, Func<KeyValuePair<'TKey, 'TValue>, 'TValue>, IEqualityComparer<'TKey>, IEqualityComparer<'TValue>)

Overloaded. Enumerates and transforms a sequence, and produces an immutable dictionary of its contents by using the specified key and value comparers.(Defined by ImmutableDictionary.)

System_CAPS_pubmethodToImmutableHashSet<KeyValuePair<'TKey, 'TValue>>()

Overloaded. Enumerates a sequence and produces an immutable hash set of its contents.(Defined by ImmutableHashSet.)

System_CAPS_pubmethodToImmutableHashSet<KeyValuePair<'TKey, 'TValue>>(IEqualityComparer<KeyValuePair<'TKey, 'TValue>>)

Overloaded. Enumerates a sequence, produces an immutable hash set of its contents, and uses the specified equality comparer for the set type.(Defined by ImmutableHashSet.)

System_CAPS_pubmethodToImmutableList<KeyValuePair<'TKey, 'TValue>>()

Enumerates a sequence and produces an immutable list of its contents.(Defined by ImmutableList.)

System_CAPS_pubmethodToImmutableSortedDictionary<KeyValuePair<'TKey, 'TValue>, 'TKey, 'TValue>(Func<KeyValuePair<'TKey, 'TValue>, 'TKey>, Func<KeyValuePair<'TKey, 'TValue>, 'TValue>)

Overloaded. Enumerates and transforms a sequence, and produces an immutable sorted dictionary of its contents.(Defined by ImmutableSortedDictionary.)

System_CAPS_pubmethodToImmutableSortedDictionary<KeyValuePair<'TKey, 'TValue>, 'TKey, 'TValue>(Func<KeyValuePair<'TKey, 'TValue>, 'TKey>, Func<KeyValuePair<'TKey, 'TValue>, 'TValue>, IComparer<'TKey>)

Overloaded. Enumerates and transforms a sequence, and produces an immutable sorted dictionary of its contents by using the specified key comparer.(Defined by ImmutableSortedDictionary.)

System_CAPS_pubmethodToImmutableSortedDictionary<KeyValuePair<'TKey, 'TValue>, 'TKey, 'TValue>(Func<KeyValuePair<'TKey, 'TValue>, 'TKey>, Func<KeyValuePair<'TKey, 'TValue>, 'TValue>, IComparer<'TKey>, IEqualityComparer<'TValue>)

Overloaded. Enumerates and transforms a sequence, and produces an immutable sorted dictionary of its contents by using the specified key and value comparers.(Defined by ImmutableSortedDictionary.)

System_CAPS_pubmethodToImmutableSortedSet<KeyValuePair<'TKey, 'TValue>>()

Overloaded. Enumerates a sequence and produces an immutable sorted set of its contents.(Defined by ImmutableSortedSet.)

System_CAPS_pubmethodToImmutableSortedSet<KeyValuePair<'TKey, 'TValue>>(IComparer<KeyValuePair<'TKey, 'TValue>>)

Overloaded. Enumerates a sequence, produces an immutable sorted set of its contents, and uses the specified comparer.(Defined by ImmutableSortedSet.)

When you manipulate an immutable dictionary a copy of the original dictionary is made, manipulations applied and a new immutable dictionary is returned.

This type is thread safe.

Return to top
Show:
© 2016 Microsoft