ImmutableDictionary<TKey,TValue>.Builder Class

Definition

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)

public: ref class ImmutableDictionary<TKey, TValue>::Builder sealed : System::Collections::Generic::ICollection<System::Collections::Generic::KeyValuePair<TKey, TValue>>, System::Collections::Generic::IDictionary<TKey, TValue>, System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<TKey, TValue>>, System::Collections::Generic::IReadOnlyCollection<System::Collections::Generic::KeyValuePair<TKey, TValue>>, System::Collections::Generic::IReadOnlyDictionary<TKey, TValue>, System::Collections::IDictionary
public sealed class ImmutableDictionary<TKey,TValue>.Builder : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>, System.Collections.Generic.IDictionary<TKey,TValue>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>>, System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>, System.Collections.Generic.IReadOnlyDictionary<TKey,TValue>, System.Collections.IDictionary
type ImmutableDictionary<'Key, 'Value>.Builder = class
    interface ICollection<KeyValuePair<'Key, 'Value>>
    interface seq<KeyValuePair<'Key, 'Value>>
    interface IEnumerable
    interface IDictionary<'Key, 'Value>
    interface IReadOnlyCollection<KeyValuePair<'Key, 'Value>>
    interface IReadOnlyDictionary<'Key, 'Value>
    interface ICollection
    interface IDictionary
Public NotInheritable Class ImmutableDictionary(Of TKey, TValue).Builder
Implements ICollection(Of KeyValuePair(Of TKey, TValue)), IDictionary, IDictionary(Of TKey, TValue), IEnumerable(Of KeyValuePair(Of TKey, TValue)), IReadOnlyCollection(Of KeyValuePair(Of TKey, TValue)), IReadOnlyDictionary(Of TKey, TValue)

Type Parameters

TKey
TValue
Inheritance
ImmutableDictionary<TKey,TValue>.Builder
Implements

Remarks

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.

Properties

Count

Gets the number of elements contained in the immutable dictionary.

Item[TKey]

Gets or sets the element with the specified key.

KeyComparer

Gets or sets the key comparer.

Keys

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

ValueComparer

Gets or sets the value comparer.

Values

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

Methods

Add(KeyValuePair<TKey,TValue>)

Adds the specified item to the immutable dictionary.

Add(TKey, TValue)

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

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

Adds a sequence of values to this collection.

Clear()

Removes all items from the immutable dictionary.

Contains(KeyValuePair<TKey,TValue>)

Determines whether the immutable dictionary contains a specific value.

ContainsKey(TKey)

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

ContainsValue(TValue)

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

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator()

Returns an enumerator that iterates through the immutable dictionary.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetValueOrDefault(TKey)

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

GetValueOrDefault(TKey, TValue)

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

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(KeyValuePair<TKey,TValue>)

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

Remove(TKey)

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

RemoveRange(IEnumerable<TKey>)

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

ToImmutable()

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

ToString()

Returns a string that represents the current object.

(Inherited from Object)
TryGetKey(TKey, TKey)

Determines whether this dictionary contains a specified key.

TryGetValue(TKey, TValue)

Returns the value associated with the specified key.

Explicit Interface Implementations

ICollection.CopyTo(Array, Int32)

Copies the elements of the dictionary to an array of type KeyValuePair<TKey,TValue>, starting at the specified array index.

ICollection.IsSynchronized

Gets a value that indicates whether access to the ICollection is synchronized (thread safe).

ICollection.SyncRoot

Gets an object that can be used to synchronize access to the ICollection.

ICollection<KeyValuePair<TKey,TValue>>.CopyTo(KeyValuePair<TKey,TValue>[], Int32)
ICollection<KeyValuePair<TKey,TValue>>.IsReadOnly
IDictionary.Add(Object, Object)

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

IDictionary.Contains(Object)

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

IDictionary.GetEnumerator()

Returns an IDictionaryEnumerator object for the dictionary.

IDictionary.IsFixedSize

Gets a value that indicates whether the IDictionary object has a fixed size.

IDictionary.IsReadOnly

Gets a value that indicates whether the ICollection<T> is read-only.

IDictionary.Item[Object]

Gets or sets the element with the specified key.

IDictionary.Keys

Gets an ICollection<T> containing the keys of the IDictionary<TKey,TValue>.

IDictionary.Remove(Object)

Removes the element with the specified key from the dictionary.

IDictionary.Values

Gets an ICollection<T> containing the values in the IDictionary<TKey,TValue>.

IDictionary<TKey,TValue>.Keys
IDictionary<TKey,TValue>.Values
IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

IEnumerable<KeyValuePair<TKey,TValue>>.GetEnumerator()

Extension Methods

GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey)

Tries to get the value associated with the specified key in the dictionary.

GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey, TValue)

Tries to get the value associated with the specified key in the dictionary.

Remove<TKey,TValue>(IDictionary<TKey,TValue>, TKey, TValue)

Tries to remove the value with the specified key from the dictionary.

TryAdd<TKey,TValue>(IDictionary<TKey,TValue>, TKey, TValue)

Tries to add the specified key and value to the dictionary.

ToImmutableDictionary<TKey,TValue>(ImmutableDictionary<TKey,TValue>)

Creates an immutable dictionary from the current contents of the builder's dictionary.

CopyToDataTable<T>(IEnumerable<T>)

Returns a DataTable that contains copies of the DataRow objects, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Ancestors<T>(IEnumerable<T>)

Returns a collection of elements that contains the ancestors of every node in the source collection.

Ancestors<T>(IEnumerable<T>, XName)

Returns a filtered collection of elements that contains the ancestors of every node in the source collection. Only elements that have a matching XName are included in the collection.

DescendantNodes<T>(IEnumerable<T>)

Returns a collection of the descendant nodes of every document and element in the source collection.

Descendants<T>(IEnumerable<T>)

Returns a collection of elements that contains the descendant elements of every element and document in the source collection.

Descendants<T>(IEnumerable<T>, XName)

Returns a filtered collection of elements that contains the descendant elements of every element and document in the source collection. Only elements that have a matching XName are included in the collection.

Elements<T>(IEnumerable<T>)

Returns a collection of the child elements of every element and document in the source collection.

Elements<T>(IEnumerable<T>, XName)

Returns a filtered collection of the child elements of every element and document in the source collection. Only elements that have a matching XName are included in the collection.

InDocumentOrder<T>(IEnumerable<T>)

Returns a collection of nodes that contains all nodes in the source collection, sorted in document order.

Nodes<T>(IEnumerable<T>)

Returns a collection of the child nodes of every document and element in the source collection.

Remove<T>(IEnumerable<T>)

Removes every node in the source collection from its parent node.

Applies to