Click or drag to resize

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

Merges two ordered sequences into one. Additional parameters specify the element key by which the sequences are ordered, the result when element is found in first sequence but not in the second, the result when element is found in second sequence but not in the first and the result when elements are found in both sequences.

Namespace:  MoreLinq.Extensions
Assembly:  MoreLinq (in MoreLinq.dll) Version: 3.3.1+b77df70598ab84c28cd43dcf74594024b6d575e1
Syntax
public static IEnumerable<TResult> OrderedMerge<T, TKey, TResult>(
	this IEnumerable<T> first,
	IEnumerable<T> second,
	Func<T, TKey> keySelector,
	Func<T, TResult> firstSelector,
	Func<T, TResult> secondSelector,
	Func<T, T, TResult> bothSelector
)

Parameters

first
Type: System.Collections.GenericIEnumerableT
The first input sequence.
second
Type: System.Collections.GenericIEnumerableT
The second input sequence.
keySelector
Type: SystemFuncT, TKey
Function to extract a key given an element.
firstSelector
Type: SystemFuncT, TResult
Function to project the result element when only the first sequence yields a source element.
secondSelector
Type: SystemFuncT, TResult
Function to project the result element when only the second sequence yields a source element.
bothSelector
Type: SystemFuncT, T, TResult
Function to project the result element when only both sequences yield a source element whose keys are equal.

Type Parameters

T
Type of elements in source sequences.
TKey
Type of keys used for merging.
TResult
Type of elements in the returned sequence.

Return Value

Type: IEnumerableTResult
A sequence with projections 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