IterateIndexed2
Aplica a função action
em cada par de elementos da coleção. Neste caso a função action
além de receber os elementos, recebe seu índice.
Atenção
Este método causa a avaliação do
IEnumerable<T>
.
Parâmetros
Retorno
Action<int, T, T2> action
IEnumerable<T> source
IEnumerable<T2> source2
void
Como usar
Escrevendo todos os elementos no 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
Was this helpful?