ImmutableList Class

Definition

Provides a set of initialization methods for instances of the ImmutableList<T> class.

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

C#
public static class ImmutableList
Inheritance
ImmutableList

Methods

Create<T>()

Creates an empty immutable list.

Create<T>(ReadOnlySpan<T>)

Creates a new immutable list that contains the items from the specified span of items.

Create<T>(T)

Creates a new immutable list that contains the specified item.

Create<T>(T[])

Creates a new immutable list that contains the specified array of items.

CreateBuilder<T>()

Creates a new immutable list builder.

CreateRange<T>(IEnumerable<T>)

Creates a new immutable list that contains the specified items.

IndexOf<T>(IImmutableList<T>, T, IEqualityComparer<T>)

Searches for the specified object and returns the zero-based index of the first occurrence within the list.

IndexOf<T>(IImmutableList<T>, T, Int32, Int32)

Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the immutable list that extends from the specified index to the last element.

IndexOf<T>(IImmutableList<T>, T, Int32)

Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the immutable list that extends from the specified index to the last element.

IndexOf<T>(IImmutableList<T>, T)

Searches for the specified object and returns the zero-based index of the first occurrence within the list.

LastIndexOf<T>(IImmutableList<T>, T, IEqualityComparer<T>)

Searches for the specified object and returns the zero-based index of the last occurrence within the entire immutable list.

LastIndexOf<T>(IImmutableList<T>, T, Int32, Int32)

Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the immutable list that extends from the first element to the specified index.

LastIndexOf<T>(IImmutableList<T>, T, Int32)

Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the immutable list that extends from the first element to the specified index.

LastIndexOf<T>(IImmutableList<T>, T)

Searches for the specified object and returns the zero-based index of the last occurrence within the entire immutable list.

Remove<T>(IImmutableList<T>, T)

Removes the specified value from this list.

RemoveRange<T>(IImmutableList<T>, IEnumerable<T>)

Removes the specified values from this list.

Replace<T>(IImmutableList<T>, T, T)

Replaces the first equal element in the list with the specified element.

ToImmutableList<TSource>(IEnumerable<TSource>)

Enumerates a sequence and produces an immutable list of its contents.

ToImmutableList<TSource>(ImmutableList<TSource>.Builder)

Creates an immutable list from the current contents of the builder's collection.

Applies to

Produkt Verzie
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)
UWP 10.0

Thread Safety

This type is thread safe.