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)

public ref class ImmutableList abstract sealed
public static class ImmutableList
type ImmutableList = class
Public Module 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)

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

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)

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, 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.

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.

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)

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, 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.

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

Thread Safety

This type is thread safe.