public static IEnumerable<TResult> ZipShortest<T1, T2, T3, T4, TResult>(
this IEnumerable<T1> first,
IEnumerable<T2> second,
IEnumerable<T3> third,
IEnumerable<T4> fourth,
Func<T1, T2, T3, T4, TResult> resultSelector
)
<ExtensionAttribute>
Public Shared Function ZipShortest(Of T1, T2, T3, T4, TResult) (
first As IEnumerable(Of T1),
second As IEnumerable(Of T2),
third As IEnumerable(Of T3),
fourth As IEnumerable(Of T4),
resultSelector As Func(Of T1, T2, T3, T4, TResult)
) As IEnumerable(Of TResult)
public:
[ExtensionAttribute]
generic<typename T1, typename T2, typename T3, typename T4, typename TResult>
static IEnumerable<TResult>^ ZipShortest(
IEnumerable<T1>^ first,
IEnumerable<T2>^ second,
IEnumerable<T3>^ third,
IEnumerable<T4>^ fourth,
Func<T1, T2, T3, T4, TResult>^ resultSelector
)
[<ExtensionAttribute>]
static member ZipShortest :
first : IEnumerable<'T1> *
second : IEnumerable<'T2> *
third : IEnumerable<'T3> *
fourth : IEnumerable<'T4> *
resultSelector : Func<'T1, 'T2, 'T3, 'T4, 'TResult> -> IEnumerable<'TResult>
If the input sequences are of different lengths, the result sequence is terminated as soon as the shortest input sequence is exhausted and remainder elements from the longer sequences are never consumed.
This operator uses deferred execution and streams its results.
var numbers = new[] { 1, 2, 3 };
var letters = new[] { "A", "B", "C", "D" };
var chars = new[] { 'a', 'b', 'c', 'd', 'e' };
var flags = new[] { true, false };
var zipped = numbers.ZipShortest(letters, chars, flags, (n, l, c, f) => n + l + c + f);
ArgumentNullException | first, second, third, fourth, or resultSelector is . |