public static IEnumerable<TSource> SortedMerge<TSource>(
this IEnumerable<TSource> source,
OrderByDirection direction,
params IEnumerable<TSource>[] otherSequences
)
<ExtensionAttribute>
Public Shared Function SortedMerge(Of TSource) (
source As IEnumerable(Of TSource),
direction As OrderByDirection,
ParamArray otherSequences As IEnumerable(Of TSource)()
) As IEnumerable(Of TSource)
public:
[ExtensionAttribute]
generic<typename TSource>
static IEnumerable<TSource>^ SortedMerge(
IEnumerable<TSource>^ source,
OrderByDirection direction,
... array<IEnumerable<TSource>^>^ otherSequences
)
[<ExtensionAttribute>]
static member SortedMerge :
source : IEnumerable<'TSource> *
direction : OrderByDirection *
otherSequences : IEnumerable<'TSource>[] -> IEnumerable<'TSource>
Using SortedMergeTSource(IEnumerableTSource, OrderByDirection, IEnumerableTSource) on sequences that are not ordered or are not in the same order produces undefined results.
SortedMergeTSource(IEnumerableTSource, OrderByDirection, IEnumerableTSource) uses performs the merge in a deferred, streaming manner.
Here is an example of a merge, as well as the produced result:
var s1 = new[] { 3, 7, 11 };
var s2 = new[] { 2, 4, 20 };
var s3 = new[] { 17, 19, 25 };
var merged = s1.SortedMerge(OrderByDirection.Ascending, s2, s3);
var result = merged.ToArray();
// result will be:
// { 2, 3, 4, 7, 11, 17, 19, 20, 25 }