System.Collections.Immutable by Microsoft

<PackageReference Include="System.Collections.Immutable" Version="8.0.0-preview.2.23128.3" />

.NET API 250,032 bytes

 ImmutableSortedDictionary

public static class ImmutableSortedDictionary
A set of initialization methods for instances of ImmutableSortedDictionary<T, U>.
using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; namespace System.Collections.Immutable { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] public static class ImmutableSortedDictionary { public static ImmutableSortedDictionary<TKey, TValue> Create<TKey, [System.Runtime.CompilerServices.Nullable(2)] TValue>() { return ImmutableSortedDictionary<TKey, TValue>.Empty; } public static ImmutableSortedDictionary<TKey, TValue> Create<TKey, [System.Runtime.CompilerServices.Nullable(2)] TValue>([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] IComparer<TKey> keyComparer) { return ImmutableSortedDictionary<TKey, TValue>.Empty.WithComparers(keyComparer); } public static ImmutableSortedDictionary<TKey, TValue> Create<TKey, [System.Runtime.CompilerServices.Nullable(2)] TValue>([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] IComparer<TKey> keyComparer, [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] IEqualityComparer<TValue> valueComparer) { return ImmutableSortedDictionary<TKey, TValue>.Empty.WithComparers(keyComparer, valueComparer); } public static ImmutableSortedDictionary<TKey, TValue> CreateRange<TKey, [System.Runtime.CompilerServices.Nullable(2)] TValue>([System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1 })] IEnumerable<KeyValuePair<TKey, TValue>> items) { return ImmutableSortedDictionary<TKey, TValue>.Empty.AddRange(items); } public static ImmutableSortedDictionary<TKey, TValue> CreateRange<TKey, [System.Runtime.CompilerServices.Nullable(2)] TValue>([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] IComparer<TKey> keyComparer, [System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1 })] IEnumerable<KeyValuePair<TKey, TValue>> items) { return ImmutableSortedDictionary<TKey, TValue>.Empty.WithComparers(keyComparer).AddRange(items); } public static ImmutableSortedDictionary<TKey, TValue> CreateRange<TKey, [System.Runtime.CompilerServices.Nullable(2)] TValue>([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] IComparer<TKey> keyComparer, [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] IEqualityComparer<TValue> valueComparer, [System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1 })] IEnumerable<KeyValuePair<TKey, TValue>> items) { return ImmutableSortedDictionary<TKey, TValue>.Empty.WithComparers(keyComparer, valueComparer).AddRange(items); } public static ImmutableSortedDictionary<TKey, TValue>.Builder CreateBuilder<TKey, [System.Runtime.CompilerServices.Nullable(2)] TValue>() { return Create<TKey, TValue>().ToBuilder(); } public static ImmutableSortedDictionary<TKey, TValue>.Builder CreateBuilder<TKey, [System.Runtime.CompilerServices.Nullable(2)] TValue>([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] IComparer<TKey> keyComparer) { return Create<TKey, TValue>(keyComparer).ToBuilder(); } public static ImmutableSortedDictionary<TKey, TValue>.Builder CreateBuilder<TKey, [System.Runtime.CompilerServices.Nullable(2)] TValue>([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] IComparer<TKey> keyComparer, [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] IEqualityComparer<TValue> valueComparer) { return Create(keyComparer, valueComparer).ToBuilder(); } public static ImmutableSortedDictionary<TKey, TValue> ToImmutableSortedDictionary<[System.Runtime.CompilerServices.Nullable(2)] TSource, TKey, [System.Runtime.CompilerServices.Nullable(2)] TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] IComparer<TKey> keyComparer, [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] IEqualityComparer<TValue> valueComparer) { Requires.NotNull(source, "source"); Requires.NotNull(keySelector, "keySelector"); Requires.NotNull(elementSelector, "elementSelector"); return ImmutableSortedDictionary<TKey, TValue>.Empty.WithComparers(keyComparer, valueComparer).AddRange(from element in source select new KeyValuePair<TKey, TValue>(keySelector(element), elementSelector(element))); } public static ImmutableSortedDictionary<TKey, TValue> ToImmutableSortedDictionary<TKey, [System.Runtime.CompilerServices.Nullable(2)] TValue>(this ImmutableSortedDictionary<TKey, TValue>.Builder builder) { Requires.NotNull(builder, "builder"); return builder.ToImmutable(); } public static ImmutableSortedDictionary<TKey, TValue> ToImmutableSortedDictionary<[System.Runtime.CompilerServices.Nullable(2)] TSource, TKey, [System.Runtime.CompilerServices.Nullable(2)] TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] IComparer<TKey> keyComparer) { return source.ToImmutableSortedDictionary(keySelector, elementSelector, keyComparer, null); } public static ImmutableSortedDictionary<TKey, TValue> ToImmutableSortedDictionary<[System.Runtime.CompilerServices.Nullable(2)] TSource, TKey, [System.Runtime.CompilerServices.Nullable(2)] TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector) { return source.ToImmutableSortedDictionary(keySelector, elementSelector, null, null); } public static ImmutableSortedDictionary<TKey, TValue> ToImmutableSortedDictionary<TKey, [System.Runtime.CompilerServices.Nullable(2)] TValue>([System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1 })] this IEnumerable<KeyValuePair<TKey, TValue>> source, [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] IComparer<TKey> keyComparer, [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] IEqualityComparer<TValue> valueComparer) { Requires.NotNull(source, "source"); ImmutableSortedDictionary<TKey, TValue> immutableSortedDictionary = source as ImmutableSortedDictionary<TKey, TValue>; if (immutableSortedDictionary != null) return immutableSortedDictionary.WithComparers(keyComparer, valueComparer); return ImmutableSortedDictionary<TKey, TValue>.Empty.WithComparers(keyComparer, valueComparer).AddRange(source); } public static ImmutableSortedDictionary<TKey, TValue> ToImmutableSortedDictionary<TKey, [System.Runtime.CompilerServices.Nullable(2)] TValue>([System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1 })] this IEnumerable<KeyValuePair<TKey, TValue>> source, [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] IComparer<TKey> keyComparer) { return source.ToImmutableSortedDictionary(keyComparer, null); } public static ImmutableSortedDictionary<TKey, TValue> ToImmutableSortedDictionary<TKey, [System.Runtime.CompilerServices.Nullable(2)] TValue>([System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1 })] this IEnumerable<KeyValuePair<TKey, TValue>> source) { return source.ToImmutableSortedDictionary(null, null); } } }