# UnsafeList<T>.ReadOnly

> A read only for an UnsafeList\<T\>.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Collections.LowLevel.Unsafe](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe.md)
* **Assembly:** UnityEngine.ManagedKernelModule
* **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 UnsafeList<T>.ReadOnly : IEnumerable<T>, IEnumerable
```

## Remarks

Use [UnsafeList\<T>.AsReadOnly](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafelist1/asreadonly.md) to create a read only for a list.

## Fields

| Value                                                                                                      | Description                      |
| ---------------------------------------------------------------------------------------------------------- | -------------------------------- |
| [Length](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafelist1/readonly/length.md) | The number of elements.          |
| [Ptr](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafelist1/readonly/ptr.md)       | The internal buffer of the list. |

## Properties

| Property                                                                                                         | Description                                                     |
| ---------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| [IsCreated](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafelist1/readonly/iscreated.md) | Whether this list has been allocated (and not yet deallocated). |
| [IsEmpty](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafelist1/readonly/isempty.md)     | Whether the list is empty.                                      |

## Methods

| Method                                                                                                                                 | Description                                          |
| -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| [AsReadOnlySpan](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafelist1/readonly/asreadonlyspan.md)             | Returns ReadOnlySpan\\\<T\\> view of this container. |
| [GetEnumerator](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafelist1/readonly/getenumerator.md)               | Returns an enumerator over the elements of the list. |
| [GetUnsafeReadOnlyPtr](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafelist1/readonly/getunsafereadonlyptr.md) | Get a pointer to the data.                           |
