docs.unity.cn
    Show / Hide Table of Contents

    Class ObservableList<T>

    Observable list.

    Inheritance
    Object
    ObservableList<T>
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.Rendering
    Syntax
    public class ObservableList<T> : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable
    Type Parameters
    Name Description
    T

    Type of the list.

    Constructors

    ObservableList()

    Default Constructor.

    Declaration
    public ObservableList()

    ObservableList(IEnumerable<T>)

    Constructor.

    Declaration
    public ObservableList(IEnumerable<T> collection)
    Parameters
    Type Name Description
    IEnumerable<T> collection

    Input list.

    ObservableList(Int32)

    Constructor.

    Declaration
    public ObservableList(int capacity)
    Parameters
    Type Name Description
    Int32 capacity

    Allocation size.

    Properties

    Count

    Number of elements in the list.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    Int32
    Implements
    ICollection<T>.Count

    IsReadOnly

    Is the list read only?

    Declaration
    public bool IsReadOnly { get; }
    Property Value
    Type Description
    Boolean
    Implements
    ICollection<T>.IsReadOnly

    Item[Int32]

    Accessor.

    Declaration
    public T this[int index] { get; set; }
    Parameters
    Type Name Description
    Int32 index

    Item index.

    Property Value
    Type Description
    T

    The item at the provided index.

    Implements
    IList<T>.Item[Int32]

    Methods

    Add(T)

    Add an item to the list.

    Declaration
    public void Add(T item)
    Parameters
    Type Name Description
    T item

    Item to add to the list.

    Implements
    ICollection<T>.Add(T)

    Add(T[])

    Add multiple objects to the list.

    Declaration
    public void Add(params T[] items)
    Parameters
    Type Name Description
    T[] items

    Items to add to the list.

    Clear()

    Clear the list.

    Declaration
    public void Clear()
    Implements
    ICollection<T>.Clear()

    Contains(T)

    Check if an element is present in the list.

    Declaration
    public bool Contains(T item)
    Parameters
    Type Name Description
    T item

    Item to test against.

    Returns
    Type Description
    Boolean

    True if the item is in the list.

    Implements
    ICollection<T>.Contains(T)

    CopyTo(T[], Int32)

    Copy items in the list to an array.

    Declaration
    public void CopyTo(T[] array, int arrayIndex)
    Parameters
    Type Name Description
    T[] array

    Destination array.

    Int32 arrayIndex

    Starting index.

    Implements
    ICollection<T>.CopyTo(T[], Int32)

    GetEnumerator()

    Get enumerator.

    Declaration
    public IEnumerator<T> GetEnumerator()
    Returns
    Type Description
    IEnumerator<T>

    The list enumerator.

    Implements
    IEnumerable<T>.GetEnumerator()

    IndexOf(T)

    Get the index of an item.

    Declaration
    public int IndexOf(T item)
    Parameters
    Type Name Description
    T item

    The object to locate in the list.

    Returns
    Type Description
    Int32

    The index of the item in the list if it exists, -1 otherwise.

    Implements
    IList<T>.IndexOf(T)

    Insert(Int32, T)

    Insert an item in the list.

    Declaration
    public void Insert(int index, T item)
    Parameters
    Type Name Description
    Int32 index

    Index at which to insert the new item.

    T item

    Item to insert in the list.

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

    Remove(T)

    Remove an item from the list.

    Declaration
    public bool Remove(T item)
    Parameters
    Type Name Description
    T item

    Item to remove from the list.

    Returns
    Type Description
    Boolean

    True if the item was successfuly removed. False otherise.

    Implements
    ICollection<T>.Remove(T)

    Remove(T[])

    Remove multiple items from the list.

    Declaration
    public int Remove(params T[] items)
    Parameters
    Type Name Description
    T[] items

    Items to remove from the list.

    Returns
    Type Description
    Int32

    The number of removed items.

    RemoveAt(Int32)

    Remove an item at a specific index.

    Declaration
    public void RemoveAt(int index)
    Parameters
    Type Name Description
    Int32 index

    Index of the item to remove.

    Implements
    IList<T>.RemoveAt(Int32)

    Events

    ItemAdded

    Added item event.

    Declaration
    public event ListChangedEventHandler<T> ItemAdded
    Event Type
    Type Description
    ListChangedEventHandler<T>

    ItemRemoved

    Removed item event.

    Declaration
    public event ListChangedEventHandler<T> ItemRemoved
    Event Type
    Type Description
    ListChangedEventHandler<T>

    Explicit Interface Implementations

    IEnumerable.GetEnumerator()

    Get enumerator.

    Declaration
    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type Description
    IEnumerator

    The list enumerator.

    Implements
    IEnumerable.GetEnumerator()

    Extension Methods

    AnalyticsUtils.ToNestedColumn<T>(T, Boolean)
    AnalyticsUtils.ToNestedColumnWithDefault<T>(T, T, Boolean)
    RemoveRangeExtensions.TryRemoveElementsInRange<TValue>(IList<TValue>, Int32, Int32, out Exception)
    SwapCollectionExtensions.TrySwap<TValue>(IList<TValue>, Int32, Int32, out Exception)
    ReflectionUtils.Invoke(Object, String, Object[])
    ReflectionUtils.SetField(Object, String, Object)
    ReflectionUtils.GetField(Object, String)
    ReflectionUtils.GetFields(Object)
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on 08 September 2023