Map3
É gerada uma nova coleção com o resultado da função mapping
aplicado em cada trio de elementos das três coleções.
Parâmetros
Retorno
Func<T, T2, T3, TResult> mapping
IEnumerable<T> source
IEnumerable<T2> source2
IEnumerable<T3> source3
IEnumerable<TResult>
Como usar
Concatenando valores de três coleções
//IEnumerable<int> source = { 1, 2, 3, 4, 5 }
//IEnumerable<int> source2 = { 5, 3, 3, 3, 0 }
//IEnumerable<string> source3 = {"Value", "Value2" }
IEnumerable<string> result =
source.Map3(
source2,
source3,
(value1, value2, value3) =>
$"{value3}: {value1 + value2}");
//result = { "Value: 6", "Value2: 5" }
Last updated
Was this helpful?