# GetEnumerator()

> Gets an enumerator to iterate through the elements of a NativeSlice<T>.

## Definition

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

```csharp
public NativeSlice<T>.Enumerator GetEnumerator()
```

### Returns

| Type       | Description                                                           |
| ---------- | --------------------------------------------------------------------- |
| Enumerator | An enumerator that can iterate through the elements of a NativeSlice. |
