Click or drag to resize
MoreEnumerableZipLongestTFirst, TSecond, TResult Method
Returns a projection of tuples, where each tuple contains the N-th element from each of the argument sequences.

Namespace:  MoreLinq
Assembly:  MoreLinq (in MoreLinq.dll) Version: 2.2.0
Syntax
public static IEnumerable<TResult> ZipLongest<TFirst, TSecond, TResult>(
	this IEnumerable<TFirst> first,
	IEnumerable<TSecond> second,
	Func<TFirst, TSecond, TResult> resultSelector
)

Parameters

first
Type: System.Collections.GenericIEnumerableTFirst
First sequence
second
Type: System.Collections.GenericIEnumerableTSecond
Second sequence
resultSelector
Type: SystemFuncTFirst, TSecond, TResult
Function to apply to each pair of elements

Type Parameters

TFirst
Type of elements in first sequence
TSecond
Type of elements in second sequence
TResult
Type of elements in result sequence

Return Value

Type: IEnumerableTResult
A sequence that contains elements of the two input sequences, combined by resultSelector.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableTFirst. 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).
Remarks
If the two input sequences are of different lengths then the result sequence will always be as long as the longer of the two input sequences. The default value of the shorter sequence element type is used for padding. This operator uses deferred execution and streams its results.
Examples
int[] numbers = { 1, 2, 3 };
string[] letters = { "A", "B", "C", "D" };
var zipped = numbers.EquiZip(letters, (n, l) => n + l);
The zipped variable, when iterated over, will yield "1A", "2B", "3C", "0D" in turn.
See Also