docs.unity3d.com
    目次を表示する/隠す

    Class DynamicArray<T>

    Generic growable array.

    Inheritance
    Object
    DynamicArray<T>
    Namespace: UnityEngine.Rendering
    Syntax
    public class DynamicArray<T> : object where T : new()
    Type Parameters
    Name Description
    T

    Type of the array.

    Constructors

    DynamicArray()

    Constructor. Defaults to a size of 32 elements.

    Declaration
    public DynamicArray()

    DynamicArray(Int32)

    Constructor

    Declaration
    public DynamicArray(int size)
    Parameters
    Type Name Description
    Int32 size

    Number of elements.

    Properties

    capacity

    Allocated size of the array.

    Declaration
    public int capacity { get; }
    Property Value
    Type Description
    Int32

    Item[Int32]

    ref access to an element.

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

    Element index

    Property Value
    Type Description
    T

    The requested element.

    size

    Number of elements in the array.

    Declaration
    public int size { get; }
    Property Value
    Type Description
    Int32

    Methods

    Add(in T)

    Add an element to the array.

    Declaration
    public int Add(in T value)
    Parameters
    Type Name Description
    T value

    Element to add to the array.

    Returns
    Type Description
    Int32

    The index of the element.

    Clear()

    Clear the array of all elements.

    Declaration
    public void Clear()

    Resize(Int32, Boolean)

    Resize the Dynamic Array. This will reallocate memory if necessary and set the current size of the array to the provided size.

    Declaration
    public void Resize(int newSize, bool keepContent = false)
    Parameters
    Type Name Description
    Int32 newSize

    New size for the array.

    Boolean keepContent

    Set to true if you want the current content of the array to be kept.

    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)