Struct UnsafeQueue<T>.ReadOnly
A read-only alias for the value of a UnsafeQueue. Does not have its own allocated storage.
Namespace: Unity.Collections
Syntax
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 UnsafeQueue<T>.Enumerator GetEnumerator()
Returns
Type | Description |
---|---|
UnsafeQueue.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.