# NativeQueue<T>

> An unmanaged queue.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Collections](/engine/6000.7/script-reference/unity/collections.md)
* **Assembly:** UnityEngine.ManagedKernelModule
* **Implements:** [INativeDisposable](/engine/6000.7/script-reference/unity/collections/inativedisposable.md), [IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

```csharp
public struct NativeQueue<T> : INativeDisposable, IDisposable where T : unmanaged
```

## Constructors

| Constructor                                                                                                                                  | Description                                         |
| -------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| [NativeQueue\`1(Unity.Collections.AllocatorManager.AllocatorHandle)](/engine/6000.7/script-reference/unity/collections/nativequeue1/ctor.md) | Initializes and returns an instance of NativeQueue. |

## Properties

| Property                                                                                 | Description                                                      |
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| [Count](/engine/6000.7/script-reference/unity/collections/nativequeue1/count.md)         | Returns the current number of elements in this queue.            |
| [IsCreated](/engine/6000.7/script-reference/unity/collections/nativequeue1/iscreated.md) | Whether this queue has been allocated (and not yet deallocated). |

## Methods

| Method                                                                                                 | Description                                                         |
| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------- |
| [AsParallelWriter](/engine/6000.7/script-reference/unity/collections/nativequeue1/asparallelwriter.md) | Returns a parallel writer for this queue.                           |
| [AsReadOnly](/engine/6000.7/script-reference/unity/collections/nativequeue1/asreadonly.md)             | Returns a readonly version of this NativeQueue instance.            |
| [Clear](/engine/6000.7/script-reference/unity/collections/nativequeue1/clear.md)                       | Removes all elements from this queue.                               |
| [Dequeue](/engine/6000.7/script-reference/unity/collections/nativequeue1/dequeue.md)                   | Removes and returns the element at the front of this queue.         |
| [Dispose](/engine/6000.7/script-reference/unity/collections/nativequeue1/dispose.md)                   | Releases all resources (memory and safety handles).                 |
| [Enqueue](/engine/6000.7/script-reference/unity/collections/nativequeue1/enqueue.md)                   | Adds an element at the back of this queue.                          |
| [IsEmpty](/engine/6000.7/script-reference/unity/collections/nativequeue1/isempty.md)                   | Returns true if this queue is empty.                                |
| [Peek](/engine/6000.7/script-reference/unity/collections/nativequeue1/peek.md)                         | Returns the element at the front of this queue without removing it. |
| [ToArray](/engine/6000.7/script-reference/unity/collections/nativequeue1/toarray.md)                   | Returns an array containing a copy of this queue's content.         |
| [TryDequeue](/engine/6000.7/script-reference/unity/collections/nativequeue1/trydequeue.md)             | Removes and outputs the element at the front of this queue.         |

## Structs

| Struct                                                                                                             | Description                                                                                |
| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
| [NativeQueue\<T>.Enumerator](/engine/6000.7/script-reference/unity/collections/nativequeue1/enumerator.md)         | An enumerator over the values of a container.                                              |
| [NativeQueue\<T>.ParallelWriter](/engine/6000.7/script-reference/unity/collections/nativequeue1/parallelwriter.md) | A parallel writer for a NativeQueue.                                                       |
| [NativeQueue\<T>.ReadOnly](/engine/6000.7/script-reference/unity/collections/nativequeue1/readonly.md)             | A read-only alias for the value of a NativeQueue. Does not have its own allocated storage. |
