IImmutableList<T> Interface

 

Represents a list of elements that cannot be modified.

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

Namespace:   System.Collections.Immutable
Assembly:  System.Collections.Immutable (in System.Collections.Immutable.dll)

public interface IImmutableList<T> : IReadOnlyList<T>, IReadOnlyCollection<T>, 
	IEnumerable<T>, IEnumerable

Type Parameters

T

The type of elements in the list.

NameDescription
System_CAPS_pubpropertyCount

(Inherited from IReadOnlyCollection<T>.)

System_CAPS_pubpropertyItem[Int32]

(Inherited from IReadOnlyList<T>.)

NameDescription
System_CAPS_pubmethodAdd(T)

Makes a copy of the list, and adds the specified object to the end of the copied list.

System_CAPS_pubmethodAddRange(IEnumerable<T>)

Makes a copy of the list and adds the specified objects to the end of the copied list.

System_CAPS_pubmethodClear()

Creates a list with all the items removed, but with the same sorting and ordering semantics as this list.

System_CAPS_pubmethodGetEnumerator()

(Inherited from IEnumerable<T>.)

System_CAPS_pubmethodIndexOf(T, Int32, Int32, IEqualityComparer<T>)

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

System_CAPS_pubmethodInsert(Int32, T)

Inserts the specified element at the specified index in the immutable list.

System_CAPS_pubmethodInsertRange(Int32, IEnumerable<T>)

Inserts the specified elements at the specified index in the immutable list.

System_CAPS_pubmethodLastIndexOf(T, Int32, Int32, IEqualityComparer<T>)

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

System_CAPS_pubmethodRemove(T, IEqualityComparer<T>)

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

System_CAPS_pubmethodRemoveAll(Predicate<T>)

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

System_CAPS_pubmethodRemoveAt(Int32)

Removes the element at the specified index of the immutable list.

System_CAPS_pubmethodRemoveRange(IEnumerable<T>, IEqualityComparer<T>)

Removes the specified object from the list.

System_CAPS_pubmethodRemoveRange(Int32, Int32)

Removes a range of elements from the IImmutableList<T>.

System_CAPS_pubmethodReplace(T, T, IEqualityComparer<T>)

Returns a new list with the first matching element in the list replaced with the specified element.

System_CAPS_pubmethodSetItem(Int32, T)

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

NameDescription
System_CAPS_pubmethodIndexOf<T>(T)

Overloaded. Searches for the specified object and returns the zero-based index of the first occurrence within the list.(Defined by ImmutableList.)

System_CAPS_pubmethodIndexOf<T>(T, IEqualityComparer<T>)

Overloaded. Searches for the specified object and returns the zero-based index of the first occurrence within the list.(Defined by ImmutableList.)

System_CAPS_pubmethodIndexOf<T>(T, Int32)

Overloaded. 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.(Defined by ImmutableList.)

System_CAPS_pubmethodIndexOf<T>(T, Int32, Int32)

Overloaded. 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.(Defined by ImmutableList.)

System_CAPS_pubmethodLastIndexOf<T>(T)

Overloaded. Searches for the specified object and returns the zero-based index of the last occurrence within the entire immutable list.(Defined by ImmutableList.)

System_CAPS_pubmethodLastIndexOf<T>(T, IEqualityComparer<T>)

Overloaded. Searches for the specified object and returns the zero-based index of the last occurrence within the entire immutable list.(Defined by ImmutableList.)

System_CAPS_pubmethodLastIndexOf<T>(T, Int32)

Overloaded. 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.(Defined by ImmutableList.)

System_CAPS_pubmethodLastIndexOf<T>(T, Int32, Int32)

Overloaded. 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.(Defined by ImmutableList.)

System_CAPS_pubmethodRemove<T>(T)

Removes the specified value from this list.(Defined by ImmutableList.)

System_CAPS_pubmethodRemoveRange<T>(IEnumerable<T>)

Removes the specified values from this list.(Defined by ImmutableList.)

System_CAPS_pubmethodReplace<T>(T, T)

Replaces the first equal element in the list with the specified element.(Defined by ImmutableList.)

System_CAPS_pubmethodToImmutableArray<T>()

Creates an immutable array from the specified collection.(Defined by ImmutableArray.)

System_CAPS_pubmethodToImmutableDictionary<T, TKey>(Func<T, TKey>)

Overloaded. Constructs an immutable dictionary from an existing collection of elements, applying a transformation function to the source keys.(Defined by ImmutableDictionary.)

System_CAPS_pubmethodToImmutableDictionary<T, TKey>(Func<T, TKey>, IEqualityComparer<TKey>)

Overloaded. Constructs an immutable dictionary based on some transformation of a sequence.(Defined by ImmutableDictionary.)

System_CAPS_pubmethodToImmutableDictionary<T, TKey, TValue>(Func<T, TKey>, Func<T, TValue>)

Overloaded. Enumerates and transforms a sequence, and produces an immutable dictionary of its contents.(Defined by ImmutableDictionary.)

System_CAPS_pubmethodToImmutableDictionary<T, TKey, TValue>(Func<T, TKey>, Func<T, TValue>, IEqualityComparer<TKey>)

Overloaded. Enumerates and transforms a sequence, and produces an immutable dictionary of its contents by using the specified key comparer.(Defined by ImmutableDictionary.)

System_CAPS_pubmethodToImmutableDictionary<T, TKey, TValue>(Func<T, TKey>, Func<T, TValue>, IEqualityComparer<TKey>, IEqualityComparer<TValue>)

Overloaded. Enumerates and transforms a sequence, and produces an immutable dictionary of its contents by using the specified key and value comparers.(Defined by ImmutableDictionary.)

System_CAPS_pubmethodToImmutableHashSet<T>()

Overloaded. Enumerates a sequence and produces an immutable hash set of its contents.(Defined by ImmutableHashSet.)

System_CAPS_pubmethodToImmutableHashSet<T>(IEqualityComparer<T>)

Overloaded. Enumerates a sequence, produces an immutable hash set of its contents, and uses the specified equality comparer for the set type.(Defined by ImmutableHashSet.)

System_CAPS_pubmethodToImmutableList<T>()

Enumerates a sequence and produces an immutable list of its contents.(Defined by ImmutableList.)

System_CAPS_pubmethodToImmutableSortedDictionary<T, TKey, TValue>(Func<T, TKey>, Func<T, TValue>)

Overloaded. Enumerates and transforms a sequence, and produces an immutable sorted dictionary of its contents.(Defined by ImmutableSortedDictionary.)

System_CAPS_pubmethodToImmutableSortedDictionary<T, TKey, TValue>(Func<T, TKey>, Func<T, TValue>, IComparer<TKey>)

Overloaded. Enumerates and transforms a sequence, and produces an immutable sorted dictionary of its contents by using the specified key comparer.(Defined by ImmutableSortedDictionary.)

System_CAPS_pubmethodToImmutableSortedDictionary<T, TKey, TValue>(Func<T, TKey>, Func<T, TValue>, IComparer<TKey>, IEqualityComparer<TValue>)

Overloaded. Enumerates and transforms a sequence, and produces an immutable sorted dictionary of its contents by using the specified key and value comparers.(Defined by ImmutableSortedDictionary.)

System_CAPS_pubmethodToImmutableSortedSet<T>()

Overloaded. Enumerates a sequence and produces an immutable sorted set of its contents.(Defined by ImmutableSortedSet.)

System_CAPS_pubmethodToImmutableSortedSet<T>(IComparer<T>)

Overloaded. Enumerates a sequence, produces an immutable sorted set of its contents, and uses the specified comparer.(Defined by ImmutableSortedSet.)

When you add or remove items from an IImmutableList<T>, a copy of the original list is created, with the changes applied.. Incremental changes to a list share as much memory as possible with earlier versions of a list and enable garbage collection to clean up any unique list data that is no longer being referenced.

To create a new list, use the Create method.

The IImmutableList<T> has no public constructor, as this would create an empty immutable list. You should create a new list using the Create method. You can add new items to a copy of the original list using the Add, and AddRange methods.

Return to top
Show: