# NativeArray<T>.ReadOnly

> Represents a NativeArray<T> interface constrained to read-only operations.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Collections](/engine/6000.6/script-reference/unity/collections.md)
* **Assembly:** UnityEngine.CoreModule
* **Implements:** [IEnumerable\<T>](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1), [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.ienumerable)

```csharp
public struct NativeArray<T>.ReadOnly : IEnumerable<T>, IEnumerable
```

## Properties

| Property                                                                                          | Description                                                                                                                                             |
| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [IsCreated](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly/iscreated.md) | Indicates that a [NativeArray\<T>.ReadOnly](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly.md) has an allocated memory buffer. |
| [this\[\]](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly/item.md)       | Provides read-only access to [NativeArray\<T>.ReadOnly](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly.md) elements by index.  |
| [Length](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly/length.md)       | Provides the number of elements in the [NativeArray\<T>.ReadOnly](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly.md).          |

## Methods

| Method                                                                                                        | Description                                                                                                                                                          |
| ------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AsReadOnlySpan](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly/asreadonlyspan.md)   | Exposes [NativeArray\<T>.ReadOnly](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly.md) data as a `System.ReadOnlySpan<T>`.                   |
| [CopyTo](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly/copyto.md)                   | Copies all elements to a [NativeArray\<T>.ReadOnly](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly.md) or managed array of the same length. |
| [GetEnumerator](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly/getenumerator.md)     | Gets an enumerator.                                                                                                                                                  |
| [Reinterpret](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly/reinterpret.md)         | Reinterpret a [NativeArray\<T>.ReadOnly](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly.md) with a different data type (type punning).      |
| [ToArray](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly/toarray.md)                 | Convert the data in a [NativeArray\<T>.ReadOnly](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly.md) to a managed array.                     |
| [UnsafeElementAt](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly/unsafeelementat.md) | Provides read-only access to [NativeArray\<T>.ReadOnly](/engine/6000.6/script-reference/unity/collections/nativearray1/readonly.md) elements by index.               |
