# World.NoAllocReadOnlyCollection<T>

> Read only collection that doesn't generate garbage when used in a foreach.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule
* **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 World.NoAllocReadOnlyCollection<T> : IEnumerable<T>, IEnumerable
```

## Constructors

| Constructor                                                                                                                                                    | Description              |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
| [NoAllocReadOnlyCollection\`1(System.Collections.Generic.List\{\`0})](/engine/7000.0/script-reference/unity/entities/world/noallocreadonlycollection1/ctor.md) | Construct a new instance |

## Properties

| Property                                                                                            | Description                     |
| --------------------------------------------------------------------------------------------------- | ------------------------------- |
| [Count](/engine/7000.0/script-reference/unity/entities/world/noallocreadonlycollection1/count.md)   | The number of list elements     |
| [this\[\]](/engine/7000.0/script-reference/unity/entities/world/noallocreadonlycollection1/item.md) | Look up a list element by index |

## Methods

| Method                                                                                                            | Description                                   |
| ----------------------------------------------------------------------------------------------------------------- | --------------------------------------------- |
| [Contains](/engine/7000.0/script-reference/unity/entities/world/noallocreadonlycollection1/contains.md)           | Check if the list contains a specific element |
| [GetEnumerator](/engine/7000.0/script-reference/unity/entities/world/noallocreadonlycollection1/getenumerator.md) | Get an enumerator interface to the list       |
