OrderedMergeExtensionOrderedMergeT, TKey(IEnumerableT, IEnumerableT, FuncT, TKey) Method

Merges two ordered sequences into one with an additional parameter specifying the element key by which the sequences are ordered. Where the keys equal in both sequences, the element from the first sequence is returned in the resulting sequence.

Definition

Namespace: MoreLinq.Extensions
Assembly: MoreLinq (in MoreLinq.dll) Version: 3.4.0+b99a6a8cc504caf2d48372fe54a2f8116c59cd0c
C#
public static IEnumerable<T> OrderedMerge<T, TKey>(
	this IEnumerable<T> first,
	IEnumerable<T> second,
	Func<T, TKey> keySelector
)

Parameters

first  IEnumerableT
The first input sequence.
second  IEnumerableT
The second input sequence.
keySelector  FuncT, TKey
Function to extract a key given an element.

Type Parameters

T
Type of elements in input and output sequences.
TKey
Type of keys used for merging.

Return Value

IEnumerableT
A sequence with elements from the two input sequences merged according to a key, as in a full outer join.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableT. 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

This method uses deferred execution. The behavior is undefined if the sequences are unordered (by key) as inputs.

See Also