docs.unity.cn
    Show / Hide Table of Contents

    Struct NativeQueue<T>.ReadOnly

    A read-only alias for the value of a NativeQueue. Does not have its own allocated storage.

    Namespace: Unity.Collections
    Syntax
    [NativeContainer]
    [NativeContainerIsReadOnly]
    public struct ReadOnly : IEnumerable<T>, IEnumerable

    Properties

    Count

    Returns the current number of elements in this queue.

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

    The current number of elements in this queue.

    Remarks

    Note that getting the count requires traversing the queue's internal linked list of blocks. Where possible, cache this value instead of reading the property repeatedly.

    IsCreated

    Whether this container been allocated (and not yet deallocated).

    Declaration
    public readonly bool IsCreated { get; }
    Property Value
    Type Description
    Boolean

    True if this container has been allocated (and not yet deallocated).

    Item[Int32]

    The element at an index.

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

    An index.

    Property Value
    Type Description
    T

    The element at the index.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Thrown if the index is out of bounds.

    Methods

    GetEnumerator()

    Returns an enumerator over the items of this container.

    Declaration
    public readonly NativeQueue<T>.Enumerator GetEnumerator()
    Returns
    Type Description
    NativeQueue.Enumerator<>

    An enumerator over the items of this container.

    IsEmpty()

    Returns true if this queue is empty.

    Declaration
    public readonly bool IsEmpty()
    Returns
    Type Description
    Boolean

    True if this queue has no items or if the queue has not been constructed.

    Remarks

    Note that getting the count requires traversing the queue's internal linked list of blocks. Where possible, cache this value instead of reading the property repeatedly.

    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Thursday, May 11, 2023