Map3
Builds a new collection whose elements are the results of applying the given mapping
function to the corresponding elements of the three collections simultaneously.
Parameters | Returns |
---|---|
Func<T, T2, T3, TResult> mapping IEnumerable<T> source IEnumerable<T2> source2 IEnumerable<T3> source3 |
IEnumerable<TResult> |
Usage
Concatenating values from three collections
//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" }