ImmutableArray<T> ImmutableArray<T> ImmutableArray<T> ImmutableArray<T> Struct

Definition

Represents an array that is immutable; meaning it cannot be changed once it is created.

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

generic <typename T>
public value class ImmutableArray : IEquatable<System::Collections::Immutable::ImmutableArray<T>>, System::Collections::Generic::ICollection<T>, System::Collections::Generic::IEnumerable<T>, System::Collections::Generic::IList<T>, System::Collections::Generic::IReadOnlyCollection<T>, System::Collections::Generic::IReadOnlyList<T>, System::Collections::IList, System::Collections::Immutable::IImmutableList<T>, System::Collections::IStructuralComparable, System::Collections::IStructuralEquatable
public struct ImmutableArray<T> : IEquatable<System.Collections.Immutable.ImmutableArray<T>>, System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T>, System.Collections.IList, System.Collections.Immutable.IImmutableList<T>, System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable
type ImmutableArray<'T> = struct
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
    interface IList<'T>
    interface IReadOnlyCollection<'T>
    interface IReadOnlyList<'T>
    interface ICollection
    interface IList
    interface IImmutableList<'T>
Public Structure ImmutableArray(Of T)
Implements ICollection(Of T), IEnumerable(Of T), IEquatable(Of ImmutableArray(Of T)), IImmutableList(Of T), IList, IList(Of T), IReadOnlyCollection(Of T), IReadOnlyList(Of T), IStructuralComparable, IStructuralEquatable

Type Parameters

T

The type of element stored by the array.

Inheritance
ImmutableArray<T>ImmutableArray<T>ImmutableArray<T>ImmutableArray<T>
Implements

Remarks

There are different scenarios best for ImmutableArray<T> and others best for ImmutableList<T>.

Reasons to use immutable array:

  • Updating the data is rare or the number of elements is quite small (less than 16 items)

  • You need to be able to iterate over the data in performance critical sections

  • You have many instances of immutable collections and you can't afford keeping the data in trees

Reasons to use immutable list:

  • Updating the data is common or the number of elements isn't expected to be small

  • Updating the collection is more performance critical than iterating the contents

The following table summarizes the performance characteristics of ImmutableArray<T>

Operation ImmutableArray<T> Complexity ImmutableList<T> Complexity Comments
Item O(1) O(log n) Directly index into the underlying array
Add() O(n) O(log n) Requires creating a new array

Fields

Empty Empty Empty Empty

Gets an empty immutable array.

Properties

IsDefault IsDefault IsDefault IsDefault

Gets a value indicating whether this array was declared but not initialized.

IsDefaultOrEmpty IsDefaultOrEmpty IsDefaultOrEmpty IsDefaultOrEmpty

Gets a value indicating whether this ImmutableArray<T> is empty or is not initialized.

IsEmpty IsEmpty IsEmpty IsEmpty

Gets a value indicating whether this ImmutableArray<T> is empty.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

Gets the element at the specified index in the immutable array.

Length Length Length Length

Gets the number of elements in the array.

Methods

Add(T) Add(T) Add(T) Add(T)

Returns a copy of the original array with the specified item added to the end.

AddRange(IEnumerable<T>) AddRange(IEnumerable<T>) AddRange(IEnumerable<T>) AddRange(IEnumerable<T>)

Returns a copy of the original array with the specified elements added to the end of the array.

AddRange(ImmutableArray<T>) AddRange(ImmutableArray<T>) AddRange(ImmutableArray<T>) AddRange(ImmutableArray<T>)

Returns a copy of the original array with the specified elements added to the end of the array.

As<TOther>() As<TOther>() As<TOther>() As<TOther>()

Returns a new immutable array that contains the elements of this array cast to a different type.

AsMemory() AsMemory() AsMemory() AsMemory()
AsSpan() AsSpan() AsSpan() AsSpan()
CastArray<TOther>() CastArray<TOther>() CastArray<TOther>() CastArray<TOther>()

Initializes a new instance of the ImmutableArray<T> struct by casting the underlying array to an array of type TOther
.

CastUp<TDerived>(ImmutableArray<TDerived>) CastUp<TDerived>(ImmutableArray<TDerived>) CastUp<TDerived>(ImmutableArray<TDerived>) CastUp<TDerived>(ImmutableArray<TDerived>)

Initializes a new instance of the ImmutableArray<T> struct based on the contents of an existing instance, allowing a covariant static cast to efficiently reuse the existing array.

Clear() Clear() Clear() Clear()

Returns an array with all the elements removed.

Contains(T) Contains(T) Contains(T) Contains(T)

Determines whether the specified item exists in the array.

CopyTo(Int32, T[], Int32, Int32) CopyTo(Int32, T[], Int32, Int32) CopyTo(Int32, T[], Int32, Int32) CopyTo(Int32, T[], Int32, Int32)

Copies the specified items in this array to the specified array at the specified starting index.

CopyTo(T[], Int32) CopyTo(T[], Int32) CopyTo(T[], Int32) CopyTo(T[], Int32)

Copies the contents of this array to the specified array starting at the specified destination index.

CopyTo(T[]) CopyTo(T[]) CopyTo(T[]) CopyTo(T[])

Copies the contents of this array to the specified array.

Equals(ImmutableArray<T>) Equals(ImmutableArray<T>) Equals(ImmutableArray<T>) Equals(ImmutableArray<T>)

Indicates whether specified array is equal to this array.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines if this array is equal to the specified object.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator that iterates through the contents of the array.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Returns a hash code for this instance.

IndexOf(T) IndexOf(T) IndexOf(T) IndexOf(T)

Searches the array for the specified item.

IndexOf(T, Int32) IndexOf(T, Int32) IndexOf(T, Int32) IndexOf(T, Int32)

Searches the array for the specified item.

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

Searches the array for the specified item.

IndexOf(T, Int32, Int32) IndexOf(T, Int32, Int32) IndexOf(T, Int32, Int32) IndexOf(T, Int32, Int32)

Searches the array for the specified item.

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

Searches the array for the specified item.

Insert(Int32, T) Insert(Int32, T) Insert(Int32, T) Insert(Int32, T)

Returns a new array with the specified value inserted at the specified position.

InsertRange(Int32, IEnumerable<T>) InsertRange(Int32, IEnumerable<T>) InsertRange(Int32, IEnumerable<T>) InsertRange(Int32, IEnumerable<T>)

Inserts the specified values at the specified index.

InsertRange(Int32, ImmutableArray<T>) InsertRange(Int32, ImmutableArray<T>) InsertRange(Int32, ImmutableArray<T>) InsertRange(Int32, ImmutableArray<T>)

Inserts the specified values at the specified index.

ItemRef(Int32) ItemRef(Int32) ItemRef(Int32) ItemRef(Int32)

Gets a read-only reference to the element at the specified index in the read-only list.

LastIndexOf(T) LastIndexOf(T) LastIndexOf(T) LastIndexOf(T)

Searches the array for the specified item; starting at the end of the array.

LastIndexOf(T, Int32) LastIndexOf(T, Int32) LastIndexOf(T, Int32) LastIndexOf(T, Int32)

Searches the array for the specified item; starting at the end of the array.

LastIndexOf(T, Int32, Int32) LastIndexOf(T, Int32, Int32) LastIndexOf(T, Int32, Int32) LastIndexOf(T, Int32, Int32)

Searches the array for the specified item; starting at the end of the array.

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

Searches the array for the specified item; starting at the end of the array.

OfType<TResult>() OfType<TResult>() OfType<TResult>() OfType<TResult>()

Filters the elements of this array to those assignable to the specified type.

Remove(T) Remove(T) Remove(T) Remove(T)

Returns an array with the first occurrence of the specified element removed from the array. If no match is found, the current array is returned.

Remove(T, IEqualityComparer<T>) Remove(T, IEqualityComparer<T>) Remove(T, IEqualityComparer<T>) Remove(T, IEqualityComparer<T>)

Returns an array with the first occurrence of the specified element removed from the array.

If no match is found, the current array is returned.

RemoveAll(Predicate<T>) RemoveAll(Predicate<T>) RemoveAll(Predicate<T>) RemoveAll(Predicate<T>)

Removes all the items from the array that meet the specified condition.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

Returns an array with the element at the specified position removed.

RemoveRange(ImmutableArray<T>, IEqualityComparer<T>) RemoveRange(ImmutableArray<T>, IEqualityComparer<T>) RemoveRange(ImmutableArray<T>, IEqualityComparer<T>) RemoveRange(ImmutableArray<T>, IEqualityComparer<T>)

Removes the specified items from this list.

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

Removes the specified items from this array.

RemoveRange(Int32, Int32) RemoveRange(Int32, Int32) RemoveRange(Int32, Int32) RemoveRange(Int32, Int32)

Returns an array with the elements at the specified position removed.

RemoveRange(IEnumerable<T>) RemoveRange(IEnumerable<T>) RemoveRange(IEnumerable<T>) RemoveRange(IEnumerable<T>)

Removes the specified items from this array.

RemoveRange(ImmutableArray<T>) RemoveRange(ImmutableArray<T>) RemoveRange(ImmutableArray<T>) RemoveRange(ImmutableArray<T>)

Removes the specified values from this list.

Replace(T, T) Replace(T, T) Replace(T, T) Replace(T, T)

Finds the first element in the array equal to the specified value and replaces the value with the specified new value.

Replace(T, T, IEqualityComparer<T>) Replace(T, T, IEqualityComparer<T>) Replace(T, T, IEqualityComparer<T>) Replace(T, T, IEqualityComparer<T>)

Finds the first element in the array equal to the specified value and replaces the value with the specified new value.

SetItem(Int32, T) SetItem(Int32, T) SetItem(Int32, T) SetItem(Int32, T)

Replaces the item at the specified index with the specified item.

Sort() Sort() Sort() Sort()

Sorts the elements in the immutable array using the default comparer.

Sort(IComparer<T>) Sort(IComparer<T>) Sort(IComparer<T>) Sort(IComparer<T>)

Sorts the elements in the immutable array using the specified comparer.

Sort(Comparison<T>) Sort(Comparison<T>) Sort(Comparison<T>) Sort(Comparison<T>)

Sorts the elements in the entire ImmutableArray<T> using the specified Comparison<T>.

Sort(Int32, Int32, IComparer<T>) Sort(Int32, Int32, IComparer<T>) Sort(Int32, Int32, IComparer<T>) Sort(Int32, Int32, IComparer<T>)

Sorts the specified elements in the immutable array using the specified comparer.

ToBuilder() ToBuilder() ToBuilder() ToBuilder()

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

Operators

Equality(ImmutableArray<T>, ImmutableArray<T>) Equality(ImmutableArray<T>, ImmutableArray<T>) Equality(ImmutableArray<T>, ImmutableArray<T>) Equality(ImmutableArray<T>, ImmutableArray<T>)

Returns a value that indicates if two arrays are equal.

Equality(Nullable<ImmutableArray<T>>, Nullable<ImmutableArray<T>>) Equality(Nullable<ImmutableArray<T>>, Nullable<ImmutableArray<T>>) Equality(Nullable<ImmutableArray<T>>, Nullable<ImmutableArray<T>>) Equality(Nullable<ImmutableArray<T>>, Nullable<ImmutableArray<T>>)

Returns a value that indicates if two arrays are equal.

Inequality(ImmutableArray<T>, ImmutableArray<T>) Inequality(ImmutableArray<T>, ImmutableArray<T>) Inequality(ImmutableArray<T>, ImmutableArray<T>) Inequality(ImmutableArray<T>, ImmutableArray<T>)

Returns a value that indicates whether two arrays are not equal.

Inequality(Nullable<ImmutableArray<T>>, Nullable<ImmutableArray<T>>) Inequality(Nullable<ImmutableArray<T>>, Nullable<ImmutableArray<T>>) Inequality(Nullable<ImmutableArray<T>>, Nullable<ImmutableArray<T>>) Inequality(Nullable<ImmutableArray<T>>, Nullable<ImmutableArray<T>>)

Checks for inequality between two array.

Explicit Interface Implementations

ICollection<T>.Add(T) ICollection<T>.Add(T) ICollection<T>.Add(T) ICollection<T>.Add(T)

Throws NotSupportedException in all cases.

ICollection<T>.Clear() ICollection<T>.Clear() ICollection<T>.Clear() ICollection<T>.Clear()

Throws NotSupportedException in all cases.

ICollection<T>.Count ICollection<T>.Count ICollection<T>.Count ICollection<T>.Count

Gets the number of array in the collection.

ICollection<T>.IsReadOnly ICollection<T>.IsReadOnly ICollection<T>.IsReadOnly ICollection<T>.IsReadOnly

Gets a value indicating whether this instance is read only.

ICollection<T>.Remove(T) ICollection<T>.Remove(T) ICollection<T>.Remove(T) ICollection<T>.Remove(T)

Throws NotSupportedException in all cases.

IEnumerable<T>.GetEnumerator() IEnumerable<T>.GetEnumerator() IEnumerable<T>.GetEnumerator() IEnumerable<T>.GetEnumerator()

Returns an enumerator that iterates through the array.

IList<T>.Insert(Int32, T) IList<T>.Insert(Int32, T) IList<T>.Insert(Int32, T) IList<T>.Insert(Int32, T)

Throws NotSupportedException in all cases.

IList<T>.Item[Int32] IList<T>.Item[Int32] IList<T>.Item[Int32] IList<T>.Item[Int32]

Gets or sets the element at the specified index in the read-only list.

IList<T>.RemoveAt(Int32) IList<T>.RemoveAt(Int32) IList<T>.RemoveAt(Int32) IList<T>.RemoveAt(Int32)

Throws NotSupportedException in all cases.

IReadOnlyCollection<T>.Count IReadOnlyCollection<T>.Count IReadOnlyCollection<T>.Count IReadOnlyCollection<T>.Count

Gets the number of array in the collection.

IReadOnlyList<T>.Item[Int32] IReadOnlyList<T>.Item[Int32] IReadOnlyList<T>.Item[Int32] IReadOnlyList<T>.Item[Int32]

Gets the element at the specified index.

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

Copies this array to another array starting at the specified index.

ICollection.Count ICollection.Count ICollection.Count ICollection.Count

Gets the size of the array.

ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

See the ICollection interface.

ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

Gets the sync root.

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

Returns an enumerator that iterates through the immutable array.

IList.Add(Object) IList.Add(Object) IList.Add(Object) IList.Add(Object)

Throws NotSupportedException in all cases.

IList.Clear() IList.Clear() IList.Clear() IList.Clear()

Throws NotSupportedException in all cases.

IList.Contains(Object) IList.Contains(Object) IList.Contains(Object) IList.Contains(Object)

Throws NotSupportedException in all cases.

IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object)

Gets the value at the specified index.

IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object)

Throws NotSupportedException in all cases.

IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize

Gets a value indicating whether this instance is fixed size.

IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly

Gets a value indicating whether this instance is read only.

IList.Item[Int32] IList.Item[Int32] IList.Item[Int32] IList.Item[Int32]

Gets or sets the Object at the specified index.

IList.Remove(Object) IList.Remove(Object) IList.Remove(Object) IList.Remove(Object)

Throws NotSupportedException in all cases.

IList.RemoveAt(Int32) IList.RemoveAt(Int32) IList.RemoveAt(Int32) IList.RemoveAt(Int32)

Throws NotSupportedException in all cases.

IImmutableList<T>.Add(T) IImmutableList<T>.Add(T) IImmutableList<T>.Add(T) IImmutableList<T>.Add(T)

Returns a copy of the original array with the specified item added to the end.

IImmutableList<T>.AddRange(IEnumerable<T>) IImmutableList<T>.AddRange(IEnumerable<T>) IImmutableList<T>.AddRange(IEnumerable<T>) IImmutableList<T>.AddRange(IEnumerable<T>)

Returns a copy of the original array with the specified elements added to the end of the array.

IImmutableList<T>.Clear() IImmutableList<T>.Clear() IImmutableList<T>.Clear() IImmutableList<T>.Clear()

Returns an array with all the elements removed.

IImmutableList<T>.Insert(Int32, T) IImmutableList<T>.Insert(Int32, T) IImmutableList<T>.Insert(Int32, T) IImmutableList<T>.Insert(Int32, T)

Returns a new array with the specified value inserted at the specified position.

IImmutableList<T>.InsertRange(Int32, IEnumerable<T>) IImmutableList<T>.InsertRange(Int32, IEnumerable<T>) IImmutableList<T>.InsertRange(Int32, IEnumerable<T>) IImmutableList<T>.InsertRange(Int32, IEnumerable<T>)

Inserts the specified values at the specified index

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

Returns an array with the first occurrence of the specified element removed from the array; if no match is found, the current array is returned.

IImmutableList<T>.RemoveAll(Predicate<T>) IImmutableList<T>.RemoveAll(Predicate<T>) IImmutableList<T>.RemoveAll(Predicate<T>) IImmutableList<T>.RemoveAll(Predicate<T>)

Removes all the items from the array that meet the specified condition.

IImmutableList<T>.RemoveAt(Int32) IImmutableList<T>.RemoveAt(Int32) IImmutableList<T>.RemoveAt(Int32) IImmutableList<T>.RemoveAt(Int32)

Returns an array with the element at the specified position removed.

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

Removes the specified items from this array.

IImmutableList<T>.RemoveRange(Int32, Int32) IImmutableList<T>.RemoveRange(Int32, Int32) IImmutableList<T>.RemoveRange(Int32, Int32) IImmutableList<T>.RemoveRange(Int32, Int32)

Returns an array with the elements at the specified position removed.

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

Finds the first element in the array equal to the specified value and replaces the value with the specified new value.

IImmutableList<T>.SetItem(Int32, T) IImmutableList<T>.SetItem(Int32, T) IImmutableList<T>.SetItem(Int32, T) IImmutableList<T>.SetItem(Int32, T)

Replaces the item at the specified index with the specified item.

IStructuralComparable.CompareTo(Object, IComparer) IStructuralComparable.CompareTo(Object, IComparer) IStructuralComparable.CompareTo(Object, IComparer) IStructuralComparable.CompareTo(Object, IComparer)

Determines whether the current collection element precedes, occurs in the same position as, or follows another element in the sort order.

IStructuralEquatable.Equals(Object, IEqualityComparer) IStructuralEquatable.Equals(Object, IEqualityComparer) IStructuralEquatable.Equals(Object, IEqualityComparer) IStructuralEquatable.Equals(Object, IEqualityComparer)

Determines whether this array is structurally equal to the specified array.

IStructuralEquatable.GetHashCode(IEqualityComparer) IStructuralEquatable.GetHashCode(IEqualityComparer) IStructuralEquatable.GetHashCode(IEqualityComparer) IStructuralEquatable.GetHashCode(IEqualityComparer)

Returns a hash code for the current instance.

Extension Methods

BinarySearch<T>(ImmutableArray<T>, T) BinarySearch<T>(ImmutableArray<T>, T) BinarySearch<T>(ImmutableArray<T>, T) BinarySearch<T>(ImmutableArray<T>, T)

Searches the sorted immutable array for a specified element using the default comparer and returns the zero-based index of the element, if it's found.

BinarySearch<T>(ImmutableArray<T>, T, IComparer<T>) BinarySearch<T>(ImmutableArray<T>, T, IComparer<T>) BinarySearch<T>(ImmutableArray<T>, T, IComparer<T>) BinarySearch<T>(ImmutableArray<T>, T, IComparer<T>)

Searches a sorted immutable array for a specified element and returns the zero-based index of the element, if it's found.

BinarySearch<T>(ImmutableArray<T>, Int32, Int32, T) BinarySearch<T>(ImmutableArray<T>, Int32, Int32, T) BinarySearch<T>(ImmutableArray<T>, Int32, Int32, T) BinarySearch<T>(ImmutableArray<T>, Int32, Int32, T)

Searches a sorted immutable array for a specified element and returns the zero-based index of the element, if it's found.

BinarySearch<T>(ImmutableArray<T>, Int32, Int32, T, IComparer<T>) BinarySearch<T>(ImmutableArray<T>, Int32, Int32, T, IComparer<T>) BinarySearch<T>(ImmutableArray<T>, Int32, Int32, T, IComparer<T>) BinarySearch<T>(ImmutableArray<T>, Int32, Int32, T, IComparer<T>)

Searches a sorted immutable array for a specified element and returns the zero-based index of the element.

IndexOf<T>(IImmutableList<T>, T) IndexOf<T>(IImmutableList<T>, T) IndexOf<T>(IImmutableList<T>, T) 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>) IndexOf<T>(IImmutableList<T>, T, IEqualityComparer<T>) IndexOf<T>(IImmutableList<T>, T, IEqualityComparer<T>) 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) IndexOf<T>(IImmutableList<T>, T, Int32) IndexOf<T>(IImmutableList<T>, T, Int32) 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) IndexOf<T>(IImmutableList<T>, T, Int32, Int32) IndexOf<T>(IImmutableList<T>, T, Int32, Int32) 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) LastIndexOf<T>(IImmutableList<T>, T) LastIndexOf<T>(IImmutableList<T>, T) 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>) LastIndexOf<T>(IImmutableList<T>, T, IEqualityComparer<T>) LastIndexOf<T>(IImmutableList<T>, T, IEqualityComparer<T>) 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) LastIndexOf<T>(IImmutableList<T>, T, Int32) LastIndexOf<T>(IImmutableList<T>, T, Int32) 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) LastIndexOf<T>(IImmutableList<T>, T, Int32, Int32) LastIndexOf<T>(IImmutableList<T>, T, Int32, Int32) 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) Remove<T>(IImmutableList<T>, T) Remove<T>(IImmutableList<T>, T) Remove<T>(IImmutableList<T>, T)

Removes the specified value from this list.

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

Removes the specified values from this list.

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

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

CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>)

Returns a DataTable that contains copies of the DataRow objects, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

Aggregate<T>(ImmutableArray<T>, Func<T,T,T>) Aggregate<T>(ImmutableArray<T>, Func<T,T,T>) Aggregate<T>(ImmutableArray<T>, Func<T,T,T>) Aggregate<T>(ImmutableArray<T>, Func<T,T,T>)

Applies a function to a sequence of elements in a cumulative way.

Aggregate<TAccumulate,T>(ImmutableArray<T>, TAccumulate, Func<TAccumulate,T,TAccumulate>) Aggregate<TAccumulate,T>(ImmutableArray<T>, TAccumulate, Func<TAccumulate,T,TAccumulate>) Aggregate<TAccumulate,T>(ImmutableArray<T>, TAccumulate, Func<TAccumulate,T,TAccumulate>) Aggregate<TAccumulate,T>(ImmutableArray<T>, TAccumulate, Func<TAccumulate,T,TAccumulate>)

Applies a function to a sequence of elements in a cumulative way.

Aggregate<TAccumulate,TResult,T>(ImmutableArray<T>, TAccumulate, Func<TAccumulate,T,TAccumulate>, Func<TAccumulate,TResult>) Aggregate<TAccumulate,TResult,T>(ImmutableArray<T>, TAccumulate, Func<TAccumulate,T,TAccumulate>, Func<TAccumulate,TResult>) Aggregate<TAccumulate,TResult,T>(ImmutableArray<T>, TAccumulate, Func<TAccumulate,T,TAccumulate>, Func<TAccumulate,TResult>) Aggregate<TAccumulate,TResult,T>(ImmutableArray<T>, TAccumulate, Func<TAccumulate,T,TAccumulate>, Func<TAccumulate,TResult>)

Applies a function to a sequence of elements in a cumulative way.

All<T>(ImmutableArray<T>, Func<T,Boolean>) All<T>(ImmutableArray<T>, Func<T,Boolean>) All<T>(ImmutableArray<T>, Func<T,Boolean>) All<T>(ImmutableArray<T>, Func<T,Boolean>)

Gets a value indicating whether all elements in this array match a given condition.

Any<T>(ImmutableArray<T>) Any<T>(ImmutableArray<T>) Any<T>(ImmutableArray<T>) Any<T>(ImmutableArray<T>)

Gets a value indicating whether the array contains any elements.

Any<T>(ImmutableArray<T>, Func<T,Boolean>) Any<T>(ImmutableArray<T>, Func<T,Boolean>) Any<T>(ImmutableArray<T>, Func<T,Boolean>) Any<T>(ImmutableArray<T>, Func<T,Boolean>)

Gets a value indicating whether the array contains any elements that match a specified condition.

ElementAt<T>(ImmutableArray<T>, Int32) ElementAt<T>(ImmutableArray<T>, Int32) ElementAt<T>(ImmutableArray<T>, Int32) ElementAt<T>(ImmutableArray<T>, Int32)

Returns the element at a specified index in the array.

ElementAtOrDefault<T>(ImmutableArray<T>, Int32) ElementAtOrDefault<T>(ImmutableArray<T>, Int32) ElementAtOrDefault<T>(ImmutableArray<T>, Int32) ElementAtOrDefault<T>(ImmutableArray<T>, Int32)

Returns the element at a specified index in a sequence or a default value if the index is out of range.

First<T>(ImmutableArray<T>) First<T>(ImmutableArray<T>) First<T>(ImmutableArray<T>) First<T>(ImmutableArray<T>)

Returns the first element in an array.

First<T>(ImmutableArray<T>, Func<T,Boolean>) First<T>(ImmutableArray<T>, Func<T,Boolean>) First<T>(ImmutableArray<T>, Func<T,Boolean>) First<T>(ImmutableArray<T>, Func<T,Boolean>)

Returns the first element in a sequence that satisfies a specified condition.

FirstOrDefault<T>(ImmutableArray<T>) FirstOrDefault<T>(ImmutableArray<T>) FirstOrDefault<T>(ImmutableArray<T>) FirstOrDefault<T>(ImmutableArray<T>)

Returns the first element of a sequence, or a default value if the sequence contains no elements.

FirstOrDefault<T>(ImmutableArray<T>, Func<T,Boolean>) FirstOrDefault<T>(ImmutableArray<T>, Func<T,Boolean>) FirstOrDefault<T>(ImmutableArray<T>, Func<T,Boolean>) FirstOrDefault<T>(ImmutableArray<T>, Func<T,Boolean>)

Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.

Last<T>(ImmutableArray<T>) Last<T>(ImmutableArray<T>) Last<T>(ImmutableArray<T>) Last<T>(ImmutableArray<T>)

Returns the last element of the array.

Last<T>(ImmutableArray<T>, Func<T,Boolean>) Last<T>(ImmutableArray<T>, Func<T,Boolean>) Last<T>(ImmutableArray<T>, Func<T,Boolean>) Last<T>(ImmutableArray<T>, Func<T,Boolean>)

Returns the last element of a sequence that satisfies a specified condition.

LastOrDefault<T>(ImmutableArray<T>) LastOrDefault<T>(ImmutableArray<T>) LastOrDefault<T>(ImmutableArray<T>) LastOrDefault<T>(ImmutableArray<T>)

Returns the last element of a sequence, or a default value if the sequence contains no elements.

LastOrDefault<T>(ImmutableArray<T>, Func<T,Boolean>) LastOrDefault<T>(ImmutableArray<T>, Func<T,Boolean>) LastOrDefault<T>(ImmutableArray<T>, Func<T,Boolean>) LastOrDefault<T>(ImmutableArray<T>, Func<T,Boolean>)

Returns the last element of a sequence that satisfies a condition or a default value if no such element is found.

Select<T,TResult>(ImmutableArray<T>, Func<T,TResult>) Select<T,TResult>(ImmutableArray<T>, Func<T,TResult>) Select<T,TResult>(ImmutableArray<T>, Func<T,TResult>) Select<T,TResult>(ImmutableArray<T>, Func<T,TResult>)

Projects each element of a sequence into a new form.

Single<T>(ImmutableArray<T>) Single<T>(ImmutableArray<T>) Single<T>(ImmutableArray<T>) Single<T>(ImmutableArray<T>)

Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.

Single<T>(ImmutableArray<T>, Func<T,Boolean>) Single<T>(ImmutableArray<T>, Func<T,Boolean>) Single<T>(ImmutableArray<T>, Func<T,Boolean>) Single<T>(ImmutableArray<T>, Func<T,Boolean>)

Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.

SingleOrDefault<T>(ImmutableArray<T>) SingleOrDefault<T>(ImmutableArray<T>) SingleOrDefault<T>(ImmutableArray<T>) SingleOrDefault<T>(ImmutableArray<T>)

Returns the only element of the array, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.

SingleOrDefault<T>(ImmutableArray<T>, Func<T,Boolean>) SingleOrDefault<T>(ImmutableArray<T>, Func<T,Boolean>) SingleOrDefault<T>(ImmutableArray<T>, Func<T,Boolean>) SingleOrDefault<T>(ImmutableArray<T>, Func<T,Boolean>)

Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.

ToArray<T>(ImmutableArray<T>) ToArray<T>(ImmutableArray<T>) ToArray<T>(ImmutableArray<T>) ToArray<T>(ImmutableArray<T>)

Copies the contents of this array to a mutable array.

ToDictionary<TKey,T>(ImmutableArray<T>, Func<T,TKey>) ToDictionary<TKey,T>(ImmutableArray<T>, Func<T,TKey>) ToDictionary<TKey,T>(ImmutableArray<T>, Func<T,TKey>) ToDictionary<TKey,T>(ImmutableArray<T>, Func<T,TKey>)

Creates a dictionary based on the contents of this array.

ToDictionary<TKey,T>(ImmutableArray<T>, Func<T,TKey>, IEqualityComparer<TKey>) ToDictionary<TKey,T>(ImmutableArray<T>, Func<T,TKey>, IEqualityComparer<TKey>) ToDictionary<TKey,T>(ImmutableArray<T>, Func<T,TKey>, IEqualityComparer<TKey>) ToDictionary<TKey,T>(ImmutableArray<T>, Func<T,TKey>, IEqualityComparer<TKey>)

Creates a dictionary based on the contents of this array.

ToDictionary<TKey,TElement,T>(ImmutableArray<T>, Func<T,TKey>, Func<T,TElement>) ToDictionary<TKey,TElement,T>(ImmutableArray<T>, Func<T,TKey>, Func<T,TElement>) ToDictionary<TKey,TElement,T>(ImmutableArray<T>, Func<T,TKey>, Func<T,TElement>) ToDictionary<TKey,TElement,T>(ImmutableArray<T>, Func<T,TKey>, Func<T,TElement>)

Creates a dictionary based on the contents of this array.

ToDictionary<TKey,TElement,T>(ImmutableArray<T>, Func<T,TKey>, Func<T,TElement>, IEqualityComparer<TKey>) ToDictionary<TKey,TElement,T>(ImmutableArray<T>, Func<T,TKey>, Func<T,TElement>, IEqualityComparer<TKey>) ToDictionary<TKey,TElement,T>(ImmutableArray<T>, Func<T,TKey>, Func<T,TElement>, IEqualityComparer<TKey>) ToDictionary<TKey,TElement,T>(ImmutableArray<T>, Func<T,TKey>, Func<T,TElement>, IEqualityComparer<TKey>)

Creates a dictionary based on the contents of this array.

Where<T>(ImmutableArray<T>, Func<T,Boolean>) Where<T>(ImmutableArray<T>, Func<T,Boolean>) Where<T>(ImmutableArray<T>, Func<T,Boolean>) Where<T>(ImmutableArray<T>, Func<T,Boolean>)

Filters a sequence of values based on a predicate.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>)

Returns a collection of elements that contains the ancestors of every node in the source collection.

Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName)

Returns a filtered collection of elements that contains the ancestors of every node in the source collection. Only elements that have a matching XName are included in the collection.

DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>)

Returns a collection of the descendant nodes of every document and element in the source collection.

Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>)

Returns a collection of elements that contains the descendant elements of every element and document in the source collection.

Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName)

Returns a filtered collection of elements that contains the descendant elements of every element and document in the source collection. Only elements that have a matching XName are included in the collection.

Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>)

Returns a collection of the child elements of every element and document in the source collection.

Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName)

Returns a filtered collection of the child elements of every element and document in the source collection. Only elements that have a matching XName are included in the collection.

InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>)

Returns a collection of nodes that contains all nodes in the source collection, sorted in document order.

Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>)

Returns a collection of the child nodes of every document and element in the source collection.

Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>)

Removes every node in the source collection from its parent node.

Applies to

Thread Safety

This type is thread safe.