Method WithIndices
- Namespace
- Gamelogic.Extensions.Algorithms
- Assembly
- Gamelogic.Extensions.dll
WithIndices<T>(IEnumerable<T>)
Iterates over a collection, yielding each element along with its index.
[Version(3, 2, 0)]
public static IEnumerable<(T item, int index)> WithIndices<T>(this IEnumerable<T> source)
Parameters
source
IEnumerable<T>The source collection to iterate over.
Returns
- IEnumerable<(T item, int index)>
An enumerable of tuples containing the elements and their indices.
Type Parameters
T
The type of elements in the collection.