MoreEnumerableOrderedMergeT, 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
Assembly:
MoreLinq (in MoreLinq.dll) Version: 3.0.0
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
)
<ExtensionAttribute>
Public Shared Function OrderedMerge(Of T, TKey, TResult) (
first As IEnumerable(Of T),
second As IEnumerable(Of T),
keySelector As Func(Of T, TKey),
firstSelector As Func(Of T, TResult),
secondSelector As Func(Of T, TResult),
bothSelector As Func(Of T, T, TResult)
) As IEnumerable(Of TResult)
public:
[ExtensionAttribute]
generic<typename T, typename TKey, typename TResult>
static IEnumerable<TResult>^ OrderedMerge(
IEnumerable<T>^ first,
IEnumerable<T>^ second,
Func<T, TKey>^ keySelector,
Func<T, TResult>^ firstSelector,
Func<T, TResult>^ secondSelector,
Func<T, T, TResult>^ bothSelector
)
[<ExtensionAttribute>]
static member OrderedMerge :
first : IEnumerable<'T> *
second : IEnumerable<'T> *
keySelector : Func<'T, 'TKey> *
firstSelector : Func<'T, 'TResult> *
secondSelector : Func<'T, 'TResult> *
bothSelector : Func<'T, 'T, 'TResult> -> IEnumerable<'TResult>
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