# AsNativeArray()

> Return a native array that aliases the original buffer contents.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule

```csharp
public NativeArray<T> AsNativeArray()
```

### Returns

| Type                                                                                 | Description                        |
| ------------------------------------------------------------------------------------ | ---------------------------------- |
| [NativeArray\<T>](/engine/7000.0/script-reference/unity/collections/nativearray1.md) | A NativeArray view of this buffer. |

### Remarks

You can only access the native array as long as the the buffer memory has not been reallocated. Several dynamic buffer operations, such as [DynamicBuffer\<T>.Add](/engine/7000.0/script-reference/unity/entities/dynamicbuffer1/add.md) and [DynamicBuffer\<T>.TrimExcess](/engine/7000.0/script-reference/unity/entities/dynamicbuffer1/trimexcess.md) can result in buffer reallocation.
