IImmutableDictionary<TKey,TValue> IImmutableDictionary<TKey,TValue> IImmutableDictionary<TKey,TValue> IImmutableDictionary<TKey,TValue> Interface

Definition

Represents an immutable collection of key/value pairs.

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

generic <typename TKey, typename TValue>
public interface class IImmutableDictionary : 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>
public interface IImmutableDictionary<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>
type IImmutableDictionary<'Key, 'Value> = interface
    interface seq<KeyValuePair<'Key, 'Value>>
    interface IEnumerable
    interface IReadOnlyCollection<KeyValuePair<'Key, 'Value>>
    interface IReadOnlyDictionary<'Key, 'Value>
Public Interface IImmutableDictionary(Of TKey, TValue)
Implements IEnumerable(Of KeyValuePair(Of TKey, TValue)), IReadOnlyCollection(Of KeyValuePair(Of TKey, TValue)), IReadOnlyDictionary(Of TKey, TValue)

Type Parameters

TKey

The type of keys in the dictionary.

TValue

The type of values in the dictionary.

Derived
Implements

Remarks

A IImmutableDictionary<TKey,TValue> requires an equality comparer implementation to determine if two keys are equal.

Methods

Add(TKey, TValue) Add(TKey, TValue) Add(TKey, TValue) Add(TKey, TValue)

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

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

Adds the specified key/value pairs to the dictionary.

Clear() Clear() Clear() Clear()

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

Contains(KeyValuePair<TKey,TValue>) Contains(KeyValuePair<TKey,TValue>) Contains(KeyValuePair<TKey,TValue>) Contains(KeyValuePair<TKey,TValue>)

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

ContainsKey(TKey) ContainsKey(TKey) ContainsKey(TKey) ContainsKey(TKey)

Determines whether the read-only dictionary contains an element that has the specified key.

(Inherited from IReadOnlyDictionary<TKey,TValue>)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator that iterates through a collection.

(Inherited from IEnumerable)
Remove(TKey) Remove(TKey) Remove(TKey) Remove(TKey)

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

RemoveRange(IEnumerable<TKey>) RemoveRange(IEnumerable<TKey>) RemoveRange(IEnumerable<TKey>) RemoveRange(IEnumerable<TKey>)

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

SetItem(TKey, TValue) SetItem(TKey, TValue) SetItem(TKey, TValue) SetItem(TKey, TValue)

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

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

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

TryGetKey(TKey, TKey) TryGetKey(TKey, TKey) TryGetKey(TKey, TKey) TryGetKey(TKey, TKey)

Determines whether this dictionary contains a specified key.

TryGetValue(TKey, TValue) TryGetValue(TKey, TValue) TryGetValue(TKey, TValue) TryGetValue(TKey, TValue)

Gets the value that is associated with the specified key.

(Inherited from IReadOnlyDictionary<TKey,TValue>)

Properties

Count Count Count Count

Gets the number of elements in the collection.

(Inherited from IReadOnlyCollection<T>)
Item[TKey] Item[TKey] Item[TKey] Item[TKey]

Gets the element that has the specified key in the read-only dictionary.

(Inherited from IReadOnlyDictionary<TKey,TValue>)
Keys Keys Keys Keys

Gets an enumerable collection that contains the keys in the read-only dictionary.

(Inherited from IReadOnlyDictionary<TKey,TValue>)
Values Values Values Values

Gets an enumerable collection that contains the values in the read-only dictionary.

(Inherited from IReadOnlyDictionary<TKey,TValue>)

Extension Methods

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

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

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

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

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

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

CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) 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) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) 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) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) 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) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

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

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) 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) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) 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>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>)

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

Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) 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) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) 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>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) 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) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) 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>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) 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>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>)

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

Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>)

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

Applies to