# BeginForEachIndex(int)

> Readies this reader to read a particular buffer of the stream.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Collections](/engine/6000.7/script-reference/unity/collections.md)
* **Assembly:** UnityEngine.ManagedKernelModule

```csharp
public int BeginForEachIndex(int foreachIndex)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The index of the buffer to read.

### Returns

| Type                                                       | Description                                          |
| ---------------------------------------------------------- | ---------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The number of elements left to read from the buffer. |

### Remarks

Must be called before using this reader. For an individual reader, call this method only once.

When done using this reader, you must call [NativeStream.Reader.EndForEachIndex](/engine/6000.7/script-reference/unity/collections/nativestream/reader/endforeachindex.md).
