System.Collections.Immutable by Microsoft

<PackageReference Include="System.Collections.Immutable" Version="6.0.0-preview.2.21154.6" />

.NET API 196,984 bytes

 ImmutableSortedDictionary<TKey, TValue>

public sealed class ImmutableSortedDictionary<TKey, TValue> : IImmutableDictionary<TKey, TValue>, IReadOnlyDictionary<TKey, TValue>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, ISortKeyCollection<TKey>, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IDictionary, ICollection
Represents an immutable sorted dictionary. NuGet package: System.Collections.Immutable (about immutable collections and how to install)
public sealed class Builder<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IDictionary, ICollection

Represents a sorted dictionary that mutates with little or no memory allocations and that can produce or build on immutable sorted dictionary instances very efficiently. NuGet package: System.Collections.Immutable (about immutable collections and how to install)

public struct Enumerator<TKey, TValue> : IEnumerator<KeyValuePair<TKey, TValue>>, IEnumerator, IDisposable, ISecurePooledObjectUser

Enumerates the contents of a binary tree. NuGet package: System.Collections.Immutable (about immutable collections and how to install)

public static readonly ImmutableSortedDictionary<TKey, TValue> Empty

Gets an empty immutable sorted dictionary.

public int Count { get; }

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

public bool IsEmpty { get; }

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

public TValue this[TKey key] { get; }

Gets the TValue associated with the specified key.

public IComparer<TKey> KeyComparer { get; }

Gets the key comparer for the immutable sorted dictionary.

public IEnumerable<TKey> Keys { get; }

Gets the keys in the immutable sorted dictionary.

public IEqualityComparer<TValue> ValueComparer { get; }

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

public IEnumerable<TValue> Values { get; }

Gets the values in the immutable sorted dictionary.

public ImmutableSortedDictionary<TKey, TValue> Add(TKey key, TValue value)

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

public ImmutableSortedDictionary<TKey, TValue> AddRange(IEnumerable<KeyValuePair<TKey, TValue>> items)

Adds the specific key/value pairs to the immutable sorted dictionary.

public ImmutableSortedDictionary<TKey, TValue> Clear()

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

public bool Contains(KeyValuePair<TKey, TValue> pair)

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

public bool ContainsKey(TKey key)

Determines whether this immutable sorted map contains the specified key.

public bool ContainsValue(TValue value)

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

public Enumerator<TKey, TValue> GetEnumerator()

Returns an enumerator that iterates through the immutable sorted dictionary.

public ImmutableSortedDictionary<TKey, TValue> Remove(TKey value)

Removes the element with the specified value from the immutable sorted dictionary.

public ImmutableSortedDictionary<TKey, TValue> RemoveRange(IEnumerable<TKey> keys)

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

public ImmutableSortedDictionary<TKey, TValue> SetItem(TKey key, TValue value)

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

public ImmutableSortedDictionary<TKey, TValue> SetItems(IEnumerable<KeyValuePair<TKey, TValue>> items)

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

public Builder<TKey, TValue> ToBuilder()

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

public bool TryGetKey(TKey equalKey, out TKey actualKey)

Determines whether this dictionary contains a specified key.

public bool TryGetValue(TKey key, out TValue value)

Gets the value associated with the specified key.

public TValue& modreq(System.Runtime.InteropServices.InAttribute) ValueRef(TKey key)

Returns a read-only reference to the value associated with the provided key.

public ImmutableSortedDictionary<TKey, TValue> WithComparers(IComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer)

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

public ImmutableSortedDictionary<TKey, TValue> WithComparers(IComparer<TKey> keyComparer)

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