<PackageReference Include="System.Collections.Immutable" Version="11.0.0-preview.4.26230.115" />

System.Collections.Immutable.ImmutableList<T>

Represents an immutable list, which is a strongly typed list of objects that can be accessed by index. NuGet package: System.Collections.Immutable (about immutable collections and how to install)

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

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

public static readonly ImmutableList<T> Empty

Gets an empty immutable list.

public int Count { get; }

Gets the number of elements contained in the list.

public bool IsEmpty { get; }

Gets a value that indicates whether this list is empty.

public T this[int index] { get; }

Gets the element at the specified index of the list.

public ImmutableList<T> Add(T value)

Adds the specified object to the end of the immutable list.

public ImmutableList<T> AddRange(IEnumerable<T> items)

Adds the elements of the specified collection to the end of the immutable list.

public int BinarySearch(T item)

Searches the entire sorted list for an element using the default comparer and returns the zero-based index of the element.

public int BinarySearch(T item, IComparer<T> comparer)

Searches the entire sorted list for an element using the specified comparer and returns the zero-based index of the element.

public int BinarySearch(int index, int count, T item, IComparer<T> comparer)

Searches a range of elements in the sorted list for an element using the specified comparer and returns the zero-based index of the element.

public ImmutableList<T> Clear()

Removes all elements from the immutable list.

public bool Contains(T value)

Determines whether this immutable list contains the specified value.

public ImmutableList<TOutput> ConvertAll<TOutput>(Func<T, TOutput> converter)

Converts the elements in the current immutable list to another type, and returns a list containing the converted elements.

public void CopyTo(T[] array)

Copies the entire immutable list to a compatible one-dimensional array, starting at the beginning of the target array.

public void CopyTo(T[] array, int arrayIndex)

Copies the entire immutable list to a compatible one-dimensional array, starting at the specified index of the target array.

public void CopyTo(int index, T[] array, int arrayIndex, int count)

Copies a range of elements from the immutable list to a compatible one-dimensional array, starting at the specified index of the target array.

public bool Exists(Predicate<T> match)

Determines whether the immutable list contains elements that match the conditions defined by the specified predicate.

public T Find(Predicate<T> match)

Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire immutable list.

public ImmutableList<T> FindAll(Predicate<T> match)

Retrieves all the elements that match the conditions defined by the specified predicate.

public int FindIndex(Predicate<T> match)

Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the entire immutable list.

public int FindIndex(int startIndex, Predicate<T> match)

Searches for an element that matches the conditions defined by the specified predicate, 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.

public int FindIndex(int startIndex, int count, Predicate<T> match)

Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the immutable list that starts at the specified index and contains the specified number of elements.

public T FindLast(Predicate<T> match)

Searches for an element that matches the conditions defined by the specified predicate, and returns the last occurrence within the entire immutable list.

public int FindLastIndex(Predicate<T> match)

Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the entire immutable list.

public int FindLastIndex(int startIndex, Predicate<T> match)

Searches for an element that matches the conditions defined by the specified predicate, 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.

public int FindLastIndex(int startIndex, int count, Predicate<T> match)

Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the immutable list that contains the specified number of elements and ends at the specified index.

public void ForEach(Action<T> action)

Performs the specified action on each element of the immutable list.

Returns an enumerator that iterates through the immutable list.

public ImmutableList<T> GetRange(int index, int count)

Creates a shallow copy of a range of elements in the source immutable list.

public int IndexOf(T item, int index, int count, IEqualityComparer<T> equalityComparer)

Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the list that starts at the specified index and contains the specified number of elements.

public int IndexOf(T value)

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

public ImmutableList<T> Insert(int index, T item)

Inserts the specified object into the immutable list at the specified index.

public ImmutableList<T> InsertRange(int index, IEnumerable<T> items)

Inserts the elements of a collection into the immutable list at the specified index.

public T& modreq(System.Runtime.InteropServices.InAttribute) ItemRef(int index)

Gets a read-only reference to the element of the set at the given index.

public int LastIndexOf(T item, int index, int count, IEqualityComparer<T> equalityComparer)

Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the list that contains the specified number of elements and ends at the specified index.

public ImmutableList<T> Remove(T value)

Removes the first occurrence of the specified object from this immutable list.

public ImmutableList<T> Remove(T value, IEqualityComparer<T> equalityComparer)

Removes the first occurrence of the object that matches the specified value from this immutable list.

public ImmutableList<T> RemoveAll(Predicate<T> match)

Removes all the elements that match the conditions defined by the specified predicate.

public ImmutableList<T> RemoveAt(int index)

Removes the element at the specified index.

public ImmutableList<T> RemoveRange(int index, int count)

Removes a range of elements, starting from the specified index and containing the specified number of elements, from this immutable list.

Removes a range of elements from this immutable list.

public ImmutableList<T> RemoveRange(IEnumerable<T> items, IEqualityComparer<T> equalityComparer)

Removes the specified values from this list.

public ImmutableList<T> Replace(T oldValue, T newValue)

Replaces the specified element in the immutable list with a new element.

public ImmutableList<T> Replace(T oldValue, T newValue, IEqualityComparer<T> equalityComparer)

Replaces the specified element in the immutable list with a new element.

public ImmutableList<T> Reverse()

Reverses the order of the elements in the entire immutable list.

public ImmutableList<T> Reverse(int index, int count)

Reverses the order of the elements in the specified range of the immutable list.

public ImmutableList<T> SetItem(int index, T value)

Replaces an element at a given position in the immutable list with the specified element.

public ImmutableList<T> Sort()

Sorts the elements in the entire immutable list using the default comparer.

public ImmutableList<T> Sort(Comparison<T> comparison)

Sorts the elements in the entire immutable list using the specified comparer.

public ImmutableList<T> Sort(IComparer<T> comparer)

Sorts the elements in the entire immutable list using the specified comparer.

public ImmutableList<T> Sort(int index, int count, IComparer<T> comparer)

Sorts a range of elements in the immutable list using the specified comparer.

public Builder<T> ToBuilder()

Creates a list that has the same contents as this list and can be efficiently mutated across multiple operations using standard mutable interfaces.

public bool TrueForAll(Predicate<T> match)

Determines whether every element in the immutable list matches the conditions defined by the specified predicate.