docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct ListBuffer<T>

    A list that stores value on a provided memory buffer.

    Usually use this to have a list on stack allocated memory.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.Rendering
    Assembly: Unity.RenderPipelines.Core.Runtime.dll
    Syntax
    public struct ListBuffer<T> where T : unmanaged
    Type Parameters
    Name Description
    T

    The type of the data stored in the list.

    Constructors

    ListBuffer(T*, int*, int)

    Instantiate a new list.

    Declaration
    public ListBuffer(T* bufferPtr, int* countPtr, int capacity)
    Parameters
    Type Name Description
    T* bufferPtr

    The address in memory to store the data.

    int* countPtr

    The address in memory to store the number of item of this list..

    int capacity

    The number of T that can be stored in the buffer.

    Properties

    Capacity

    The maximum number of item stored in this list.

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

    Count

    The number of item in the list.

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

    this[int]

    Get an item from the list.

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

    The index of the item to get.

    Property Value
    Type Description
    T

    A reference to the item.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    If the index is invalid.

    Methods

    CopyTo(T*, int, int)

    Copy the content of this list into another buffer in memory.

    Safety:

    • The destination must have enough memory to receive the copied data.
    Declaration
    public void CopyTo(T* dstBuffer, int startDstIndex, int copyCount)
    Parameters
    Type Name Description
    T* dstBuffer

    The destination buffer of the copy operation.

    int startDstIndex

    The index of the first element that will be copied in the destination buffer.

    int copyCount

    The number of item to copy.

    GetUnchecked(in int)

    Get an item from the list.

    Safety: index must be inside the bounds of the list.

    Declaration
    public ref T GetUnchecked(in int index)
    Parameters
    Type Name Description
    int index

    The index of the item to get.

    Returns
    Type Description
    T

    A reference to the item.

    TryAdd(in T)

    Try to add a value in the list.

    Declaration
    public bool TryAdd(in T value)
    Parameters
    Type Name Description
    T value

    A reference to the value to add.

    Returns
    Type Description
    bool

    true when the value was added, false when the value was not added because the capacity was reached.

    TryCopyFrom(T*, int)

    Try to copy the data from a buffer in this list.

    Declaration
    public bool TryCopyFrom(T* srcPtr, int count)
    Parameters
    Type Name Description
    T* srcPtr

    The pointer of the source memory to copy.

    int count

    The number of item to copy from the source buffer.

    Returns
    Type Description
    bool
    • true when the copy was performed.
    • false when the copy was aborted because the capacity of this list is too small.

    TryCopyTo(ListBuffer<T>)

    Try to copy the list into another list.

    Declaration
    public bool TryCopyTo(ListBuffer<T> other)
    Parameters
    Type Name Description
    ListBuffer<T> other

    The destination of the copy.

    Returns
    Type Description
    bool
    • true when the copy was performed.
    • false when the copy was aborted because the destination have a capacity too small.

    Extension Methods

    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)