System.Collections.Immutable by Microsoft

<PackageReference Include="System.Collections.Immutable" Version="1.6.0-preview.19073.11" />

.NET API 294,264 bytes

 ImmutableDictionary

public static class ImmutableDictionary
Provides a set of initialization methods for instances of the ImmutableDictionary<T, U> class. NuGet package: System.Collections.Immutable (about immutable collections and how to install)
public static bool Contains<TKey, TValue>(this IImmutableDictionary<TKey, TValue> map, TKey key, TValue value)

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

public static ImmutableDictionary<TKey, TValue> Create<TKey, TValue>()

Creates an empty immutable dictionary.

public static ImmutableDictionary<TKey, TValue> Create<TKey, TValue>(IEqualityComparer<TKey> keyComparer)

Creates an empty immutable dictionary that uses the specified key comparer.

public static ImmutableDictionary<TKey, TValue> Create<TKey, TValue>(IEqualityComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer)

Creates an empty immutable dictionary that uses the specified key and value comparers.

public static Builder<TKey, TValue> CreateBuilder<TKey, TValue>()

Creates a new immutable dictionary builder.

public static Builder<TKey, TValue> CreateBuilder<TKey, TValue>(IEqualityComparer<TKey> keyComparer)

Creates a new immutable dictionary builder.

public static Builder<TKey, TValue> CreateBuilder<TKey, TValue>(IEqualityComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer)

Creates a new immutable dictionary builder.

public static ImmutableDictionary<TKey, TValue> CreateRange<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>> items)

Creates a new immutable dictionary that contains the specified items.

public static ImmutableDictionary<TKey, TValue> CreateRange<TKey, TValue>(IEqualityComparer<TKey> keyComparer, IEnumerable<KeyValuePair<TKey, TValue>> items)

Creates a new immutable dictionary that contains the specified items and uses the specified key comparer.

public static ImmutableDictionary<TKey, TValue> CreateRange<TKey, TValue>(IEqualityComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer, IEnumerable<KeyValuePair<TKey, TValue>> items)

Creates a new immutable dictionary that contains the specified items and uses the specified key comparer.

public static TValue GetValueOrDefault<TKey, TValue>(this IImmutableDictionary<TKey, TValue> dictionary, TKey key)

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

public static TValue GetValueOrDefault<TKey, TValue>(this IImmutableDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue)

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

public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer)

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

public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TKey, TValue>(this Builder<TKey, TValue> builder)

public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey> keyComparer)

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

public static ImmutableDictionary<TKey, TSource> ToImmutableDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)

Constructs an immutable dictionary from an existing collection of elements, applying a transformation function to the source keys.

public static ImmutableDictionary<TKey, TSource> ToImmutableDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> keyComparer)

Constructs an immutable dictionary based on some transformation of a sequence.

public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)

Enumerates and transforms a sequence, and produces an immutable dictionary of its contents.

public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> source, IEqualityComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer)

Enumerates a sequence of key/value pairs and produces an immutable dictionary of its contents by using the specified key and value comparers.

public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> source, IEqualityComparer<TKey> keyComparer)

Enumerates a sequence of key/value pairs and produces an immutable dictionary of its contents by using the specified key comparer.

public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> source)

Enumerates a sequence of key/value pairs and produces an immutable dictionary of its contents.