IterateIndexed

pplies the given function to each element of the collection. The integer passed to the function indicates the index of element.

WARNING

This function causes IEnumerable<T> evaluation.

Parameters

Returns

Action<int, T> action

IEnumerable<T> source

void

Usage

Writing elements in console

//IEnumerable<string> source = { "Hello", " ", "Tango" }

source.IterateIndexed( (index, value) => Console.Write($"{index} - {value} ") );

//"1 - Hello 2 - Tango"

Last updated