IterateIndexed2

Applies the given function to two collections simultaneously. The integer passed to the function indicates the index of element.

WARNING

This function causes IEnumerable<T> evaluation.

Parameters

Returns

Action<int, T, T2> action

IEnumerable<T> source

IEnumerable<T2> source2

void

Usage

Writing elements in console

//IEnumerable<string> source = { "Hello", " favorite" }
//IEnumerable<string> source2 = { " my", " library" }


source.IterateIndexed2(source2, 
    (index, element1, element2) => Console.Write($" {index}:{element1}, {element2}.") );

//" 1:Hello, my. 2:favorite, library".

Last updated