MoreEnumerableOrderedMergeT, TKey, TResult(IEnumerableT, IEnumerableT, FuncT, TKey, FuncT, TResult, FuncT, TResult, FuncT, T, TResult, IComparerTKey) Method
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, the result when elements are found in
both sequences and a method for comparing keys.
Namespace: MoreLinqAssembly: MoreLinq (in MoreLinq.dll) Version: 3.4.0+b99a6a8cc504caf2d48372fe54a2f8116c59cd0c
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,
IComparer<TKey>? comparer
)
<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),
comparer As IComparer(Of TKey)
) 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,
IComparer<TKey>^ comparer
)
[<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> *
comparer : IComparer<'TKey> -> IEnumerable<'TResult>
- first IEnumerableT
- The first input sequence.
- second IEnumerableT
- The second input sequence.
- keySelector FuncT, TKey
- Function to extract a key given an element.
- firstSelector FuncT, TResult
- Function to project the result element
when only the first sequence yields a source element.
- secondSelector FuncT, TResult
- Function to project the result element
when only the second sequence yields a source element.
- bothSelector FuncT, T, TResult
- Function to project the result element
when only both sequences yield a source element whose keys are
equal.
- comparer IComparerTKey
- An IComparerT to compare keys.
- T
- Type of elements in source sequences.
- TKey
- Type of keys used for merging.
- TResult
- Type of elements in the returned sequence.
IEnumerableTResult
A sequence with projections from the two input sequences merged
according to a key, as in a full outer join.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).
This method uses deferred execution. The behavior is undefined
if the sequences are unordered (by key) as inputs.