docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ObservableList<T>

    Observable list.

    Inheritance
    object
    ObservableList<T>
    Implements
    IList<T>
    ICollection<T>
    IEnumerable<T>
    IEnumerable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.Rendering
    Assembly: Unity.RenderPipelines.Core.Runtime.dll
    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(int)

    Constructor.

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

    Allocation size.

    Properties

    Count

    Number of elements in the list.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    IsReadOnly

    Is the list read only?

    Declaration
    public bool IsReadOnly { get; }
    Property Value
    Type Description
    bool

    this[int]

    Accessor.

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

    Item index.

    Property Value
    Type Description
    T

    The item at the provided index.

    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.

    Add(params 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()

    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
    bool

    True if the item is in the list.

    CopyTo(T[], int)

    Copy items in the list to an array.

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

    Destination array.

    int arrayIndex

    Starting index.

    GetEnumerator()

    Get enumerator.

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

    The list enumerator.

    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
    int

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

    Insert(int, T)

    Insert an item in the list.

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

    Index at which to insert the new item.

    T item

    Item to insert in the list.

    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
    bool

    True if the item was successfuly removed. False otherise.

    Remove(params 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
    int

    The number of removed items.

    RemoveAt(int)

    Remove an item at a specific index.

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

    Index of the item to remove.

    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>

    Implements

    IList<T>
    ICollection<T>
    IEnumerable<T>
    IEnumerable

    Extension Methods

    RemoveRangeExtensions.TryRemoveElementsInRange<TValue>(IList<TValue>, int, int, out Exception)
    RemoveRangeExtensions.TryRemoveElementsInRange<TValue>(IList<TValue>, int, int, out Exception)
    SwapCollectionExtensions.TrySwap<TValue>(IList<TValue>, int, int, out Exception)
    SwapCollectionExtensions.TrySwap<TValue>(IList<TValue>, int, int, out Exception)
    ReflectionUtils.GetField(object, string)
    ReflectionUtils.GetFields(object)
    ReflectionUtils.Invoke(object, string, params object[])
    ReflectionUtils.SetField(object, string, object)
    AnalyticsUtils.ToNestedColumnWithDefault<T>(T, T, bool)
    AnalyticsUtils.ToNestedColumn<T>(T, bool)
    AnalyticsUtils.ToNestedColumn<T>(T, T)
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)