# BeginForEachIndex(int)

> Readies this writer to write to a particular buffer of the stream.

## Definition

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

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

### Parameters

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

### Remarks

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

When done using this writer, you must call [UnsafeStream.Writer.EndForEachIndex](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafestream/writer/endforeachindex.md).
