ImmutableDictionary<TKey, TValue>.Builder Class

 

Represents a hash map that mutates with little or no memory allocations and that can produce or build on immutable hash map instances very efficiently.

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>.Builder

[DefaultMemberAttribute("Item")]
[DebuggerDisplayAttribute("Count = {Count}")]
public sealed class Builder : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, 
	IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, 
	IEnumerable<KeyValuePair<TKey, TValue>>, IDictionary, ICollection, 
	IEnumerable

NameDescription
System_CAPS_pubpropertyCount

Gets the number of elements contained in the immutable dictionary.

System_CAPS_pubpropertyItem[TKey]

Gets or sets the element with the specified key.

System_CAPS_pubpropertyKeyComparer

Gets or sets the key comparer.

System_CAPS_pubpropertyKeys

Gets a collection that contains the keys of the immutable dictionary.

System_CAPS_pubpropertyValueComparer

Gets or sets the value comparer.

System_CAPS_pubpropertyValues

Gets a collection that contains the values of the immutable dictionary.

NameDescription
System_CAPS_pubmethodAdd(TKey, TValue)

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

System_CAPS_pubmethodAdd(KeyValuePair<TKey, TValue>)

Adds the specified item to the immutable dictionary.

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

Adds a sequence of values to this collection.

System_CAPS_pubmethodClear()

Removes all items from the immutable dictionary.

System_CAPS_pubmethodContains(KeyValuePair<TKey, TValue>)

Determines whether the immutable dictionary contains a specific value.

System_CAPS_pubmethodContainsKey(TKey)

Determines whether the immutable dictionary contains an element that has the specified key.

System_CAPS_pubmethodContainsValue(TValue)

Determines whether the immutable dictionary contains an element that has 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_pubmethodGetValueOrDefault(TKey)

Gets the value for a given key if a matching key exists in the dictionary.

System_CAPS_pubmethodGetValueOrDefault(TKey, TValue)

Gets the value for a given key if a matching key exists in the dictionary.

System_CAPS_pubmethodRemove(TKey)

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

System_CAPS_pubmethodRemove(KeyValuePair<TKey, TValue>)

Removes the first occurrence of a specific object from the immutable dictionary.

System_CAPS_pubmethodRemoveRange(IEnumerable<TKey>)

Removes any entries with keys that match those found in the specified sequence from the immutable dictionary.

System_CAPS_pubmethodToImmutable()

Creates an immutable dictionary based on the contents of this instance.

System_CAPS_pubmethodToString()

(Inherited from Object.)

System_CAPS_pubmethodTryGetKey(TKey, TKey)

Determines whether this dictionary contains a specified key.

System_CAPS_pubmethodTryGetValue(TKey, TValue)

Returns the value associated with the specified key.

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

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 of type KeyValuePair<TKey, TValue>, starting at the specified array index.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDictionary.Add(Object, Object)

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

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDictionary.Contains(Object)

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

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDictionary.GetEnumerator()

Returns an IDictionaryEnumerator object for the dictionary.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDictionary.Remove(Object)

Removes the element with the specified key from the dictionary.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

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.)

Although ImmutableDictionary<TKey, TValue>.AddRange and other methods already provide fast bulk change operations on a collection, the ImmutableDictionary<TKey, TValue>.Builder class allows multiple combinations of changes to be made to a set with equal efficiency.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: