Method SortedMergeBy
SortedMergeBy<TSource, TKey>(IAsyncEnumerable<TSource>, Func<TSource, TKey>, params IAsyncEnumerable<TSource>[])
Merges two or more sequences that are in a common order (either ascending or descending) according to a key into a single sequence that preserves that order.
Declaration
public static IAsyncEnumerable<TSource> SortedMergeBy<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, params IAsyncEnumerable<TSource>[] otherSequences)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<TSource> | source | The primary sequence with which to merge |
| Func<TSource, TKey> | keySelector | A function to extract a key from an element. |
| IAsyncEnumerable<TSource>[] | otherSequences | A variable argument array of zero or more other sequences to merge with |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<TSource> | A merged, order-preserving sequence containing all of the elements of the original sequences |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence |
| TKey | The type of the key returned by |
Remarks
Using SortedMergeBy on sequences that are not ordered or are not in the same order produces
undefined results.
This method uses deferred execution and streams its results.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentNullException |
|
| ArgumentNullException |
|
SortedMergeBy<TSource, TKey>(IAsyncEnumerable<TSource>, Func<TSource, TKey>, IComparer<TKey>?, params IAsyncEnumerable<TSource>[])
Merges two or more sequences that are in a common order (either ascending or descending) according to a key into a single sequence that preserves that order.
Declaration
public static IAsyncEnumerable<TSource> SortedMergeBy<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey>? comparer, params IAsyncEnumerable<TSource>[] otherSequences)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<TSource> | source | The primary sequence with which to merge |
| Func<TSource, TKey> | keySelector | A function to extract a key from an element. |
| IComparer<TKey> | comparer | The comparer used to evaluate the relative order between elements |
| IAsyncEnumerable<TSource>[] | otherSequences | A variable argument array of zero or more other sequences to merge with |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<TSource> | A merged, order-preserving sequence containing all of the elements of the original sequences |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence |
| TKey | The type of the key returned by |
Remarks
Using SortedMergeBy on sequences that are not ordered or are not in the same order produces
undefined results.
This method uses deferred execution and streams its results.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentNullException |
|
| ArgumentNullException |
|
SortedMergeBy<TSource, TKey>(IAsyncEnumerable<TSource>, Func<TSource, TKey>, OrderByDirection, params IAsyncEnumerable<TSource>[])
Merges two or more sequences that are in a common order (either ascending or descending) according to a key into a single sequence that preserves that order.
Declaration
public static IAsyncEnumerable<TSource> SortedMergeBy<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, OrderByDirection direction, params IAsyncEnumerable<TSource>[] otherSequences)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<TSource> | source | The primary sequence with which to merge |
| Func<TSource, TKey> | keySelector | A function to extract a key from an element. |
| OrderByDirection | direction | The ordering that all sequences must already exhibit |
| IAsyncEnumerable<TSource>[] | otherSequences | A variable argument array of zero or more other sequences to merge with |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<TSource> | A merged, order-preserving sequence containing all of the elements of the original sequences |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence |
| TKey | The type of the key returned by |
Remarks
Using SortedMergeBy on sequences that are not ordered or are not in the same order produces
undefined results.
This method uses deferred execution and streams its results.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentNullException |
|
| ArgumentNullException |
|
SortedMergeBy<TSource, TKey>(IAsyncEnumerable<TSource>, Func<TSource, TKey>, OrderByDirection, IComparer<TKey>?, params IAsyncEnumerable<TSource>[])
Merges two or more sequences that are in a common order (either ascending or descending) according to a key into a single sequence that preserves that order.
Declaration
public static IAsyncEnumerable<TSource> SortedMergeBy<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, OrderByDirection direction, IComparer<TKey>? comparer, params IAsyncEnumerable<TSource>[] otherSequences)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<TSource> | source | The primary sequence with which to merge |
| Func<TSource, TKey> | keySelector | A function to extract a key from an element. |
| OrderByDirection | direction | The ordering that all sequences must already exhibit |
| IComparer<TKey> | comparer | The comparer used to evaluate the relative order between elements |
| IAsyncEnumerable<TSource>[] | otherSequences | A variable argument array of zero or more other sequences to merge with |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<TSource> | A merged, order-preserving sequence containing all of the elements of the original sequences |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements in the sequence |
| TKey | The type of the key returned by |
Remarks
Using SortedMergeBy on sequences that are not ordered or are not in the same order produces
undefined results.
This method uses deferred execution and streams its results.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentNullException |
|
| ArgumentNullException |
|