EquiZipExtension.EquiZip<T1, T2, T3, TResult>(IEnumerable<T1>, IEnumerable<T2>, IEnumerable<T3>, Func<T1, T2, T3, TResult>) Method
Returns a projection of tuples, where each tuple contains the N-th
element from each of the argument sequences. An exception is thrown
if the input sequences are of different lengths.
Namespace: MoreLinq.ExtensionsAssembly: MoreLinq (in MoreLinq.dll) Version: 3.4.0+b99a6a8cc504caf2d48372fe54a2f8116c59cd0c
public static IEnumerable<TResult> EquiZip<T1, T2, T3, TResult>(
this IEnumerable<T1> first,
IEnumerable<T2> second,
IEnumerable<T3> third,
Func<T1, T2, T3, TResult> resultSelector
)
<ExtensionAttribute>
Public Shared Function EquiZip(Of T1, T2, T3, TResult) (
first As IEnumerable(Of T1),
second As IEnumerable(Of T2),
third As IEnumerable(Of T3),
resultSelector As Func(Of T1, T2, T3, TResult)
) As IEnumerable(Of TResult)
public:
[ExtensionAttribute]
generic<typename T1, typename T2, typename T3, typename TResult>
static IEnumerable<TResult>^ EquiZip(
IEnumerable<T1>^ first,
IEnumerable<T2>^ second,
IEnumerable<T3>^ third,
Func<T1, T2, T3, TResult>^ resultSelector
)
[<ExtensionAttribute>]
static member EquiZip :
first : IEnumerable<'T1> *
second : IEnumerable<'T2> *
third : IEnumerable<'T3> *
resultSelector : Func<'T1, 'T2, 'T3, 'TResult> -> IEnumerable<'TResult>
- first IEnumerable<T1>
- The first sequence.
- second IEnumerable<T2>
- The second sequence.
- third IEnumerable<T3>
- The third sequence.
- resultSelector Func<T1, T2, T3, TResult>
-
Function to apply to each triplet of elements.
- T1
- Type of elements in first sequence.
- T2
- Type of elements in second sequence.
- T3
- Type of elements in third sequence.
- TResult
- Type of elements in result sequence.
IEnumerable<TResult>
A sequence that contains elements of the three input sequences,
combined by
resultSelector.
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerable<T1>. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
This operator uses deferred execution and streams its results.
var numbers = new[] { 1, 2, 3, 4 };
var letters = new[] { "A", "B", "C", "D" };
var chars = new[] { 'a', 'b', 'c', 'd' };
var zipped = numbers.EquiZip(letters, chars, (n, l, c) => n + l + c);
The
zipped variable, when iterated over, will yield "1Aa",
"2Bb", "3Cc", "4Dd" in turn.