ImmutableList(T) Class
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)
Namespace: System.Collections.Immutable
Assembly: System.Collections.Immutable (in System.Collections.Immutable.dll)
[<Sealed>] type ImmutableList<'T> = class interface IImmutableList<'T> interface IList<'T> interface ICollection<'T> interface IList interface ICollection interface IReadOnlyList<'T> interface IReadOnlyCollection<'T> interface IEnumerable<'T> interface IEnumerable end
Type Parameters
- T
The type of elements in the list.
The ImmutableList(T) type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | Add | Adds the specified object to the end of the immutable list. |
![]() | AddRange | Adds the elements of the specified collection to the end of the immutable list. |
![]() | BinarySearch(T) | Searches the entire sorted list for an element using the default comparer and returns the zero-based index of the element. |
![]() | BinarySearch(T, IComparer(T)) | Searches the entire sorted list for an element using the specified comparer and returns the zero-based index of the element. |
![]() | BinarySearch(Int32, Int32, T, IComparer(T)) | 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. |
![]() | Clear | Removes all elements from the immutable list. |
![]() | Contains | Determines whether this immutable list contains the specified value. |
![]() | ConvertAll(TOutput) | Converts the elements in the current immutable list to another type, and returns a list containing the converted elements. |
![]() | CopyTo(T[]) | Copies the entire immutable list to a compatible one-dimensional array, starting at the beginning of the target array. |
![]() | CopyTo(T[], Int32) | Copies the entire immutable list to a compatible one-dimensional array, starting at the specified index of the target array. |
![]() | CopyTo(Int32, T[], Int32, Int32) | Copies a range of elements from the immutable list to a compatible one-dimensional array, starting at the specified index of the target array. |
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | Exists | Determines whether the immutable list contains elements that match the conditions defined by the specified predicate. |
![]() | Find | Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire immutable list. |
![]() | FindAll | Retrieves all the elements that match the conditions defined by the specified predicate. |
![]() | FindIndex(Predicate(T)) | 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. |
![]() | FindIndex(Int32, Predicate(T)) | 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. |
![]() | FindIndex(Int32, Int32, Predicate(T)) | 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. |
![]() | FindLast | Searches for an element that matches the conditions defined by the specified predicate, and returns the last occurrence within the entire immutable list. |
![]() | FindLastIndex(Predicate(T)) | 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. |
![]() | FindLastIndex(Int32, Predicate(T)) | 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. |
![]() | FindLastIndex(Int32, Int32, Predicate(T)) | 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. |
![]() | ForEach | Performs the specified action on each element of the immutable list. |
![]() | GetEnumerator | Returns an enumerator that iterates through the immutable list. |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object.) |
![]() | GetRange | Creates a shallow copy of a range of elements in the source immutable list. |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | IndexOf(T) | Searches for the specified object and returns the zero-based index of the first occurrence within the entire immutable list. |
![]() | IndexOf(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 list that starts at the specified index and contains the specified number of elements. |
![]() | Insert | Inserts the specified object into the immutable list at the specified index. |
![]() | InsertRange | Inserts the elements of a collection into the immutable list at the specified index. |
![]() | LastIndexOf | 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. |
![]() | Remove(T) | Removes the first occurrence of the specified object from this immutable list. |
![]() | Remove(T, IEqualityComparer(T)) | Removes the first occurrence of the object that matches the specified value from this immutable list. |
![]() | RemoveAll | Removes all the elements that match the conditions defined by the specified predicate. |
![]() | RemoveAt | Removes the element at the specified index. |
![]() | RemoveRange(IEnumerable(T)) | Removes a range of elements from this immutable list. |
![]() | RemoveRange(IEnumerable(T), IEqualityComparer(T)) | Removes the specified values from this list. |
![]() | RemoveRange(Int32, Int32) | Removes a range of elements, starting from the specified index and containing the specified number of elements, from this immutable list. |
![]() | Replace(T, T) | Replaces the specified element in the immutable list with a new element. |
![]() | Replace(T, T, IEqualityComparer(T)) | Replaces the specified element in the immutable list with a new element. |
![]() | Reverse() | Reverses the order of the elements in the entire immutable list. |
![]() | Reverse(Int32, Int32) | Reverses the order of the elements in the specified range of the immutable list. |
![]() | SetItem | Replaces an element at a given position in the immutable list with the specified element. |
![]() | Sort() | Sorts the elements in the entire immutable list using the default comparer. |
![]() | Sort(IComparer(T)) | Sorts the elements in the entire immutable list using the specified comparer. |
![]() | Sort(Comparison(T)) | Sorts the elements in the entire immutable list using the specified comparer. |
![]() | Sort(Int32, Int32, IComparer(T)) | Sorts a range of elements in the immutable list using the specified comparer. |
![]() | ToBuilder | Creates a list that has the same contents as this list and can be efficiently mutated across multiple operations using standard mutable interfaces. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
![]() | TrueForAll | Determines whether every element in the immutable list matches the conditions defined by the specified predicate. |
| Name | Description | |
|---|---|---|
![]() | IndexOf(T)(T) | Overloaded. Searches for the specified object and returns the zero-based index of the first occurrence within the list. (Defined by ImmutableList.) |
![]() | IndexOf(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.) |
![]() | IndexOf(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.) |
![]() | IndexOf(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.) |
![]() | LastIndexOf(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.) |
![]() | LastIndexOf(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.) |
![]() | LastIndexOf(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.) |
![]() | LastIndexOf(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.) |
![]() | Remove(T) | Removes the specified value from this list. (Defined by ImmutableList.) |
![]() | RemoveRange(T) | Removes the specified values from this list. (Defined by ImmutableList.) |
![]() | Replace(T) | Replaces the first equal element in the list with the specified element. (Defined by ImmutableList.) |
![]() | ToImmutableArray(T) | [This topic is preliminary and is subject to change.] Creates an immutable array from the specified collection. (Defined by ImmutableArray.) |
![]() | ToImmutableDictionary(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.) |
![]() | ToImmutableDictionary(T, TKey)(Func(T, TKey), IEqualityComparer(TKey)) | Overloaded. Constructs an immutable dictionary based on some transformation of a sequence. (Defined by ImmutableDictionary.) |
![]() | ToImmutableDictionary(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.) |
![]() | ToImmutableDictionary(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.) |
![]() | ToImmutableDictionary(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.) |
![]() | ToImmutableHashSet(T)() | Overloaded. Enumerates a sequence and produces an immutable hash set of its contents. (Defined by ImmutableHashSet.) |
![]() | ToImmutableHashSet(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.) |
![]() | ToImmutableList(T) | Enumerates a sequence and produces an immutable list of its contents. (Defined by ImmutableList.) |
![]() | ToImmutableSortedDictionary(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.) |
![]() | ToImmutableSortedDictionary(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.) |
![]() | ToImmutableSortedDictionary(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.) |
![]() | ToImmutableSortedSet(T)() | Overloaded. Enumerates a sequence and produces an immutable sorted set of its contents. (Defined by ImmutableSortedSet.) |
![]() | ToImmutableSortedSet(T)(IComparer(T)) | Overloaded. Enumerates a sequence, produces an immutable sorted set of its contents, and uses the specified comparer. (Defined by ImmutableSortedSet.) |
| Name | Description | |
|---|---|---|
![]() ![]() | ICollection(T).Add | Adds the specified item to the immutable list. |
![]() ![]() | IList.Add | Adds an item to the immutable list. |
![]() ![]() | ICollection(T).Clear | Removes all items from the immutable list. |
![]() ![]() | IList.Clear | Removes all items from the immutable list. |
![]() ![]() | IList.Contains | Determines whether the immutable list contains a specific value. |
![]() ![]() | ICollection.CopyTo | Copies the entire immutable list to a compatible one-dimensional array, starting at the specified array index. |
![]() ![]() | IEnumerable(T).GetEnumerator | Returns an enumerator that iterates through the immutable list. |
![]() ![]() | IEnumerable.GetEnumerator | Returns an enumerator that iterates through the immutable list. |
![]() ![]() | IList.IndexOf | Determines the index of a specific item in the immutable list. |
![]() ![]() | IList(T).Insert | Inserts an object in the immutable list at the specified index. |
![]() ![]() | IList.Insert | Inserts an item into the immutable list at the specified index. |
![]() ![]() | IList.IsFixedSize | Gets a value that indicates whether the list has a fixed size. |
![]() ![]() | ICollection(T).IsReadOnly | Gets a value that indicates whether the list is read-only. |
![]() ![]() | IList.IsReadOnly | Gets a value that indicates whether the immutable list is read-only. |
![]() ![]() | ICollection.IsSynchronized | Gets a value that indicates whether access to the list is synchronized. |
![]() ![]() | IList(T).Item | Gets or sets the element at the specified index. |
![]() ![]() | IList.Item | Gets or sets the element at the specified index. |
![]() ![]() | ICollection(T).Remove | Removes the first occurrence of a specific object from the immutable list. |
![]() ![]() | IList.Remove | Removes the first occurrence of a specific object from the immutable list. |
![]() ![]() | IList(T).RemoveAt | Removes the value at the specified index. |
![]() ![]() | IList.RemoveAt | Removes the item at the specified index of the immutable list. |
![]() ![]() | ICollection.SyncRoot | Gets an object that can be used to synchronize access to the ICollection. |
![]() ![]() | IImmutableList(T).Add | Adds the specified value to this immutable list. |
![]() ![]() | IImmutableList(T).AddRange | Adds the specified values to this immutable list. |
![]() ![]() | IImmutableList(T).Clear | Retrieves an empty list that has the same sorting and ordering semantics as this instance. |
![]() ![]() | IImmutableList(T).Insert | Inserts the specified element at the specified index in the immutable list. |
![]() ![]() | IImmutableList(T).InsertRange | Inserts the specified elements at the specified index in the immutable list. |
![]() ![]() | IImmutableList(T).Remove | Removes the element with the specified value from the list. |
![]() ![]() | IImmutableList(T).RemoveAll | Removes all the elements that match the conditions defined by the specified predicate. |
![]() ![]() | IImmutableList(T).RemoveAt | Removes the element at the specified index of the immutable list. |
![]() ![]() | IImmutableList(T).RemoveRange(IEnumerable(T), IEqualityComparer(T)) | Removes a range of elements from this immutable list that match the items specified. |
![]() ![]() | IImmutableList(T).RemoveRange(Int32, Int32) | Removes the specified number of elements at the specified location from this list. |
![]() ![]() | IImmutableList(T).Replace | Replaces an element in the list with the specified element. |
![]() ![]() | IImmutableList(T).SetItem | Replaces an element in the list at a given position with the specified element. |
Show:

