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