System.Collections.Immutable by Microsoft

<PackageReference Include="System.Collections.Immutable" Version="10.0.0-preview.1.25080.5" />

.NET API 250,632 bytes

 ImmutableArray

public static class ImmutableArray
Provides methods for creating an array that is immutable; meaning it cannot be changed once it is created. NuGet package: System.Collections.Immutable (about immutable collections and how to install)
public static int BinarySearch<T>(this ImmutableArray<T> array, T value)

Searches the sorted immutable array for a specified element using the default comparer and returns the zero-based index of the element, if it's found.

public static int BinarySearch<T>(this ImmutableArray<T> array, T value, IComparer<T> comparer)

Searches a sorted immutable array for a specified element and returns the zero-based index of the element, if it's found.

public static int BinarySearch<T>(this ImmutableArray<T> array, int index, int length, T value)

Searches a sorted immutable array for a specified element and returns the zero-based index of the element, if it's found.

public static int BinarySearch<T>(this ImmutableArray<T> array, int index, int length, T value, IComparer<T> comparer)

Searches a sorted immutable array for a specified element and returns the zero-based index of the element.

public static ImmutableArray<T> Create<T>()

Creates an empty immutable array.

public static ImmutableArray<T> Create<T>(T item)

Creates an immutable array that contains the specified object.

public static ImmutableArray<T> Create<T>(T item1, T item2)

Creates an immutable array that contains the specified objects.

public static ImmutableArray<T> Create<T>(T item1, T item2, T item3)

Creates an immutable array that contains the specified objects.

public static ImmutableArray<T> Create<T>(T item1, T item2, T item3, T item4)

Creates an immutable array that contains the specified objects.

public static ImmutableArray<T> Create<T>(ReadOnlySpan<T> items)

Creates an ImmutableArray<T> with the specified elements.

public static ImmutableArray<T> Create<T>(Span<T> items)

Creates an ImmutableArray<T> with the specified elements.

public static ImmutableArray<T> Create<T>(T[] items)

Creates an immutable array from the specified array of objects.

public static ImmutableArray<T> Create<T>(T[] items, int start, int length)

Creates an immutable array with specified objects from another array.

public static ImmutableArray<T> Create<T>(ImmutableArray<T> items, int start, int length)

Creates an immutable array with the specified objects from another immutable array.

public static Builder<T> CreateBuilder<T>()

Creates a mutable array that can be converted to an ImmutableArray without allocating new memory.

public static Builder<T> CreateBuilder<T>(int initialCapacity)

Creates a mutable array that can be converted to an ImmutableArray without allocating new memory.

public static ImmutableArray<T> CreateRange<T>(IEnumerable<T> items)

Creates a new ImmutableArray<T> populated with the specified items.

public static ImmutableArray<TResult> CreateRange<TSource, TResult>(ImmutableArray<TSource> items, Func<TSource, TResult> selector)

Initializes a new instance of the ImmutableArray<T> struct.

public static ImmutableArray<TResult> CreateRange<TSource, TResult>(ImmutableArray<TSource> items, int start, int length, Func<TSource, TResult> selector)

Initializes a new instance of the ImmutableArray<T> struct.

public static ImmutableArray<TResult> CreateRange<TSource, TArg, TResult>(ImmutableArray<TSource> items, Func<TSource, TArg, TResult> selector, TArg arg)

Initializes a new instance of the ImmutableArray<T> struct.

public static ImmutableArray<TResult> CreateRange<TSource, TArg, TResult>(ImmutableArray<TSource> items, int start, int length, Func<TSource, TArg, TResult> selector, TArg arg)

Initializes a new instance of the ImmutableArray<T> struct.

public static ImmutableArray<T> ToImmutableArray<T>(this ReadOnlySpan<T> items)

Produce an immutable array of contents from specified elements.

public static ImmutableArray<T> ToImmutableArray<T>(this Span<T> items)

Converts the span to an immutable array.

public static ImmutableArray<TSource> ToImmutableArray<TSource>(this IEnumerable<TSource> items)

Creates an immutable array from the specified collection.

public static ImmutableArray<TSource> ToImmutableArray<TSource>(this Builder<TSource> builder)