ExperimentalEnumerableMergeT(IEnumerableIAsyncEnumerableT, Int32) Method
Concurrently merges all the elements of multiple asynchronous streams into a single
asynchronous stream. An additional parameter specifies the maximum concurrent operations
that may be in flight at any give time.
Namespace: MoreLinq.Experimental.AsyncAssembly: MoreLinq (in MoreLinq.dll) Version: 3.4.0+b99a6a8cc504caf2d48372fe54a2f8116c59cd0c
public static IAsyncEnumerable<T> Merge<T>(
this IEnumerable<IAsyncEnumerable<T>> sources,
int maxConcurrent
)
<ExtensionAttribute>
Public Shared Function Merge(Of T) (
sources As IEnumerable(Of IAsyncEnumerable(Of T)),
maxConcurrent As Integer
) As IAsyncEnumerable(Of T)
public:
[ExtensionAttribute]
generic<typename T>
static IAsyncEnumerable<T>^ Merge(
IEnumerable<IAsyncEnumerable<T>^>^ sources,
int maxConcurrent
)
[<ExtensionAttribute>]
static member Merge :
sources : IEnumerable<IAsyncEnumerable<'T>> *
maxConcurrent : int -> IAsyncEnumerable<'T>
- sources IEnumerableIAsyncEnumerableT
- The sequence of asynchronous streams.
- maxConcurrent Int32
-
Maximum number of asynchronous operations to have in flight at any given time. A value
of 1 (or below) disables concurrency.
- T
-
The type of the elements in sources.
IAsyncEnumerableT
An asynchronous stream with all elements from all
sources.
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableIAsyncEnumerableT. 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 operator uses deferred execution and streams its results.
When maxConcurrent is 2 or greater then the elements in the resulting
stream may appear in a different order than their order in sources.
When disposed part of the way, there is a best-effort attempt to cancel all iterations
that are in flight. This requires that all asynchronous streams in sources properly honour timely cancellation.