docs.unity3d.com
Search Results for

    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
    Assembly: Unity.Collections.dll
    Syntax
    [NativeContainer]
    [NativeContainerIsReadOnly]
    public struct NativeQueue<T>.ReadOnly

    Properties

    Count

    Returns the current number of elements in this queue.

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

    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
    bool

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

    this[int]

    The element at an index.

    Declaration
    public readonly T this[int index] { get; }
    Parameters
    Type Name Description
    int 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<T>.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
    bool

    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.

    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)