Version 3.3.0.1

ImmutableList<TList, TElement> class

Namespace: Sirenix.Utilities
Assembly: Sirenix.Utilities
public sealed class ImmutableList<TList, TElement> : IImmutableList<TElement>, IImmutableList, IList, ICollection, IList<TElement>, ICollection<TElement>, IEnumerable<TElement>, IEnumerable where TList : IList<TElement>
Immutable list wraps another list, and allows for reading the inner list, without the ability to change it.
Inheritance
  • System.Object
  • ImmutableList<TList, TElement>

Type Parameters

TList

TElement

Constructors

ImmutableList(TList)
Creates an immutable list around another list.
public ImmutableList(TList innerList)
Parameters
TList innerList

Properties

Count
Number of items in the list.
public int Count { get; }
IsReadOnly
Immutable list are always readonly.
public bool IsReadOnly { get; }
Item[Int32]
Index accessor.
public TElement this[int index] { get; }
Parameters
System.Int32 index

Index.

Methods

Contains(TElement)
Returns true if the item is contained in the list.
public bool Contains(TElement item)
Parameters
TElement item

Returns
System.Boolean

CopyTo(TElement[], Int32)
Copies the list to an array.
public void CopyTo(TElement[] array, int arrayIndex)
Parameters
TElement[] array

System.Int32 arrayIndex

GetEnumerator()
Gets an enumerator.
public IEnumerator<TElement> GetEnumerator()
Returns
System.Collections.Generic.IEnumerator<TElement>

IndexOf(TElement)
Gets the index of an item.
public int IndexOf(TElement item)
Parameters
TElement item

Returns
System.Int32

Extension Methods