diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/AsyncEnumerableEx.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/AsyncEnumerableEx.cs index 91355fcaec..197b233b06 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/AsyncEnumerableEx.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/AsyncEnumerableEx.cs @@ -4,6 +4,10 @@ namespace System.Linq { + /// + /// Provides an additional set of extension methods for writing in-memory queries, transformations of async-enumerable sequences. + /// + /// public static partial class AsyncEnumerableEx { } diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Amb.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Amb.cs index 6274d8a8ad..17c6fddbcb 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Amb.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Amb.cs @@ -10,6 +10,14 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Propagates the async-enumerable sequence that reacts first. + /// + /// The type of the elements in the source sequences. + /// First async-enumerable sequence. + /// Second async-enumerable sequence. + /// An async-enumerable sequence that surfaces either of the given sequences, whichever reacted first. + /// or is null. public static IAsyncEnumerable Amb(this IAsyncEnumerable first, IAsyncEnumerable second) { if (first == null) @@ -140,6 +148,13 @@ await using (winner.ConfigureAwait(false)) } } + /// + /// Propagates the async-enumerable sequence that reacts first. + /// + /// The type of the elements in the source sequences. + /// Observable sources competing to react first. + /// An async-enumerable sequence that surfaces any of the given sequences, whichever reacted first. + /// is null. public static IAsyncEnumerable Amb(params IAsyncEnumerable[] sources) { if (sources == null) @@ -243,6 +258,13 @@ await using (winner.ConfigureAwait(false)) } } + /// + /// Propagates the async-enumerable sequence that reacts first. + /// + /// The type of the elements in the source sequences. + /// Observable sources competing to react first. + /// An async-enumerable sequence that surfaces any of the given sequences, whichever reacted first. + /// is null. public static IAsyncEnumerable Amb(this IEnumerable> sources) { if (sources == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Buffer.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Buffer.cs index 3289ac45e7..65f15287b7 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Buffer.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Buffer.cs @@ -10,6 +10,15 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Projects each element of an async-enumerable sequence into consecutive non-overlapping buffers which are produced based on element count information. + /// + /// The type of the elements in the source sequence, and in the lists in the result sequence. + /// Source sequence to produce buffers over. + /// Length of each buffer. + /// An async-enumerable sequence of buffers. + /// is null. + /// is less than or equal to zero. public static IAsyncEnumerable> Buffer(this IAsyncEnumerable source, int count) { if (source == null) @@ -42,6 +51,16 @@ await foreach (var item in source.WithCancellation(cancellationToken).ConfigureA } } + /// + /// Projects each element of an async-enumerable sequence into zero or more buffers which are produced based on element count information. + /// + /// The type of the elements in the source sequence, and in the lists in the result sequence. + /// Source sequence to produce buffers over. + /// Length of each buffer. + /// Number of elements to skip between creation of consecutive buffers. + /// An async-enumerable sequence of buffers. + /// is null. + /// or is less than or equal to zero. public static IAsyncEnumerable> Buffer(this IAsyncEnumerable source, int count, int skip) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Catch.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Catch.cs index f0637eb557..2beb882dee 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Catch.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Catch.cs @@ -16,6 +16,15 @@ public static partial class AsyncEnumerableEx // // catch (TException ex) when(!(ex is OperationCanceledException oce && oce.CancellationToken == cancellationToken)) + /// + /// Continues an async-enumerable sequence that is terminated by an exception of the specified type with the async-enumerable sequence produced by the handler. + /// + /// The type of the elements in the source sequence and sequences returned by the exception handler function. + /// The type of the exception to catch and handle. Needs to derive from . + /// Source sequence. + /// Exception handler function, producing another async-enumerable sequence. + /// An async-enumerable sequence containing the source sequence's elements, followed by the elements produced by the handler's resulting async-enumerable sequence in case an exception occurred. + /// or is null. public static IAsyncEnumerable Catch(this IAsyncEnumerable source, Func> handler) where TException : Exception { @@ -70,6 +79,15 @@ await foreach (var item in err.WithCancellation(cancellationToken).ConfigureAwai } } + /// + /// Continues an async-enumerable sequence that is terminated by an exception of the specified type with the async-enumerable sequence produced asynchronously by the handler. + /// + /// The type of the elements in the source sequence and sequences returned by the exception handler function. + /// The type of the exception to catch and handle. Needs to derive from . + /// Source sequence. + /// Exception handler function, producing another async-enumerable sequence asynchronously. + /// An async-enumerable sequence containing the source sequence's elements, followed by the elements produced by the handler's resulting async-enumerable sequence in case an exception occurred. + /// or is null. public static IAsyncEnumerable Catch(this IAsyncEnumerable source, Func>> handler) where TException : Exception { @@ -125,6 +143,15 @@ await foreach (var item in err.WithCancellation(cancellationToken).ConfigureAwai } #if !NO_DEEP_CANCELLATION + /// + /// Continues an async-enumerable sequence that is terminated by an exception of the specified type with the async-enumerable sequence produced asynchronously (cancellable) by the handler. + /// + /// The type of the elements in the source sequence and sequences returned by the exception handler function. + /// The type of the exception to catch and handle. Needs to derive from . + /// Source sequence. + /// Exception handler function, producing another async-enumerable sequence asynchronously while supporting cancellation. + /// An async-enumerable sequence containing the source sequence's elements, followed by the elements produced by the handler's resulting async-enumerable sequence in case an exception occurred. + /// or is null. public static IAsyncEnumerable Catch(this IAsyncEnumerable source, Func>> handler) where TException : Exception { @@ -180,6 +207,13 @@ await foreach (var item in err.WithCancellation(cancellationToken).ConfigureAwai } #endif + /// + /// Continues an async-enumerable sequence that is terminated by an exception with the next async-enumerable sequence. + /// + /// The type of the elements in the source and handler sequences. + /// Observable sequences to catch exceptions for. + /// An async-enumerable sequence containing elements from consecutive source sequences until a source sequence terminates successfully. + /// is null. public static IAsyncEnumerable Catch(this IEnumerable> sources) { if (sources == null) @@ -188,6 +222,13 @@ public static IAsyncEnumerable Catch(this IEnumerable + /// Continues an async-enumerable sequence that is terminated by an exception with the next async-enumerable sequence. + /// + /// The type of the elements in the source and handler sequences. + /// Observable sequences to catch exceptions for. + /// An async-enumerable sequence containing elements from consecutive source sequences until a source sequence terminates successfully. + /// is null. public static IAsyncEnumerable Catch(params IAsyncEnumerable[] sources) { if (sources == null) @@ -196,6 +237,14 @@ public static IAsyncEnumerable Catch(params IAsyncEnumerable + /// Continues an async-enumerable sequence that is terminated by an exception with the next async-enumerable sequence. + /// + /// The type of the elements in the source sequence and handler sequence. + /// First async-enumerable sequence whose exception (if any) is caught. + /// Second async-enumerable sequence used to produce results when an error occurred in the first sequence. + /// An async-enumerable sequence containing the first sequence's elements, followed by the elements of the second sequence in case an exception occurred. + /// or is null. public static IAsyncEnumerable Catch(this IAsyncEnumerable first, IAsyncEnumerable second) { if (first == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Concat.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Concat.cs index db5b6bb003..589f5b3906 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Concat.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Concat.cs @@ -10,6 +10,13 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Concatenates all inner async-enumerable sequences, as long as the previous async-enumerable sequence terminated successfully. + /// + /// The type of the elements in the source sequences. + /// Observable sequence of inner async-enumerable sequences. + /// An async-enumerable sequence that contains the elements of each observed inner sequence, in sequential order. + /// is null. public static IAsyncEnumerable Concat(this IAsyncEnumerable> sources) { if (sources == null) @@ -29,6 +36,13 @@ await foreach (var item in source.WithCancellation(cancellationToken).ConfigureA } } + /// + /// Concatenates all async-enumerable sequences in the given enumerable sequence, as long as the previous async-enumerable sequence terminated successfully. + /// + /// The type of the elements in the source sequences. + /// Observable sequences to concatenate. + /// An async-enumerable sequence that contains the elements of each given sequence, in sequential order. + /// is null. public static IAsyncEnumerable Concat(this IEnumerable> sources) { if (sources == null) @@ -48,6 +62,13 @@ await foreach (var item in source.WithCancellation(cancellationToken).ConfigureA } } + /// + /// Concatenates all of the specified async-enumerable sequences, as long as the previous async-enumerable sequence terminated successfully. + /// + /// The type of the elements in the source sequences. + /// Observable sequences to concatenate. + /// An async-enumerable sequence that contains the elements of each given sequence, in sequential order. + /// is null. public static IAsyncEnumerable Concat(params IAsyncEnumerable[] sources) { if (sources == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Defer.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Defer.cs index 06b45ad609..266bff062c 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Defer.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Defer.cs @@ -10,6 +10,13 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Returns an async-enumerable sequence that invokes the specified factory function whenever a new observer subscribes. + /// + /// The type of the elements in the sequence returned by the factory function, and in the resulting sequence. + /// The async-enumerable factory function to invoke for each consumer that starts enumerating the resulting asynchronous sequence. + /// An async-enumerable sequence whose observers trigger an invocation of the given async-enumerable factory function. + /// is null. public static IAsyncEnumerable Defer(Func> factory) { if (factory == null) @@ -26,6 +33,14 @@ await foreach (var item in factory().WithCancellation(cancellationToken).Configu } } + /// + /// Returns an async-enumerable sequence that starts the specified asynchronous factory function whenever a new observer subscribes. + /// + /// The type of the elements in the sequence returned by the factory function, and in the resulting sequence. + /// Asynchronous factory function to start for each consumer that starts enumerating the resulting asynchronous sequence. + /// An async-enumerable sequence whose observers trigger the given asynchronous async-enumerable factory function to be started. + /// is null. + /// This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11. public static IAsyncEnumerable Defer(Func>> factory) { if (factory == null) @@ -43,6 +58,16 @@ await foreach (var item in (await factory().ConfigureAwait(false)).WithCancellat } #if !NO_DEEP_CANCELLATION + /// + /// Returns an async-enumerable sequence that starts the specified cancellable asynchronous factory function whenever a new observer subscribes. + /// The CancellationToken passed to the asynchronous factory function is tied to the returned disposable subscription, allowing best-effort cancellation. + /// + /// The type of the elements in the sequence returned by the factory function, and in the resulting sequence. + /// Asynchronous factory function, supporting cancellation, to start for each consumer that starts enumerating the resulting asynchronous sequence. + /// An async-enumerable sequence whose observers trigger the given asynchronous async-enumerable factory function to be started. + /// is null. + /// This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11. + /// When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous async-enumerable factory function will be signaled. public static IAsyncEnumerable Defer(Func>> factory) { if (factory == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Distinct.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Distinct.cs index 28f623481a..59b14d1597 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Distinct.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Distinct.cs @@ -10,6 +10,16 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Returns an async-enumerable sequence that contains only distinct elements according to the keySelector. + /// + /// The type of the elements in the source sequence. + /// The type of the discriminator key computed for each element in the source sequence. + /// An async-enumerable sequence to retain distinct elements for. + /// A function to compute the comparison key for each element. + /// An async-enumerable sequence only containing the distinct elements, based on a computed key value, from the source sequence. + /// or is null. + /// Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large. public static IAsyncEnumerable Distinct(this IAsyncEnumerable source, Func keySelector) { if (source == null) @@ -20,6 +30,17 @@ public static partial class AsyncEnumerableEx return DistinctCore(source, keySelector, comparer: null); } + /// + /// Returns an async-enumerable sequence that contains only distinct elements according to the keySelector and the comparer. + /// + /// The type of the elements in the source sequence. + /// The type of the discriminator key computed for each element in the source sequence. + /// An async-enumerable sequence to retain distinct elements for. + /// A function to compute the comparison key for each element. + /// Equality comparer for source elements. + /// An async-enumerable sequence only containing the distinct elements, based on a computed key value, from the source sequence. + /// or or is null. + /// Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large. public static IAsyncEnumerable Distinct(this IAsyncEnumerable source, Func keySelector, IEqualityComparer? comparer) { if (source == null) @@ -30,6 +51,16 @@ public static partial class AsyncEnumerableEx return DistinctCore(source, keySelector, comparer); } + /// + /// Returns an async-enumerable sequence that contains only distinct elements according to the asynchronous keySelector. + /// + /// The type of the elements in the source sequence. + /// The type of the discriminator key computed for each element in the source sequence. + /// An async-enumerable sequence to retain distinct elements for. + /// An asynchronous function to compute the comparison key for each element. + /// An async-enumerable sequence only containing the distinct elements, based on a computed key value, from the source sequence. + /// or is null. + /// Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large. public static IAsyncEnumerable Distinct(this IAsyncEnumerable source, Func> keySelector) { if (source == null) @@ -41,6 +72,16 @@ public static partial class AsyncEnumerableEx } #if !NO_DEEP_CANCELLATION + /// + /// Returns an async-enumerable sequence that contains only distinct elements according to the asynchronous (cancellable) keySelector. + /// + /// The type of the elements in the source sequence. + /// The type of the discriminator key computed for each element in the source sequence. + /// An async-enumerable sequence to retain distinct elements for. + /// An asynchronous (cancellable) function to compute the comparison key for each element. + /// An async-enumerable sequence only containing the distinct elements, based on a computed key value, from the source sequence. + /// or is null. + /// Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large. public static IAsyncEnumerable Distinct(this IAsyncEnumerable source, Func> keySelector) { if (source == null) @@ -52,6 +93,17 @@ public static partial class AsyncEnumerableEx } #endif + /// + /// Returns an async-enumerable sequence that contains only distinct elements according to the asynchronous keySelector and the comparer. + /// + /// The type of the elements in the source sequence. + /// The type of the discriminator key computed for each element in the source sequence. + /// An async-enumerable sequence to retain distinct elements for. + /// An asynchronous function to compute the comparison key for each element. + /// Equality comparer for source elements. + /// An async-enumerable sequence only containing the distinct elements, based on a computed key value, from the source sequence. + /// or or is null. + /// Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large. public static IAsyncEnumerable Distinct(this IAsyncEnumerable source, Func> keySelector, IEqualityComparer? comparer) { if (source == null) @@ -63,6 +115,17 @@ public static partial class AsyncEnumerableEx } #if !NO_DEEP_CANCELLATION + /// + /// Returns an async-enumerable sequence that contains only distinct elements according to the asynchronous (cancellable) keySelector and the comparer. + /// + /// The type of the elements in the source sequence. + /// The type of the discriminator key computed for each element in the source sequence. + /// An async-enumerable sequence to retain distinct elements for. + /// An asynchronous (cancellable) function to compute the comparison key for each element. + /// Equality comparer for source elements. + /// An async-enumerable sequence only containing the distinct elements, based on a computed key value, from the source sequence. + /// or or is null. + /// Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large. public static IAsyncEnumerable Distinct(this IAsyncEnumerable source, Func> keySelector, IEqualityComparer? comparer) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/DistinctUntilChanged.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/DistinctUntilChanged.cs index 020f5b9aaa..7eb215450c 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/DistinctUntilChanged.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/DistinctUntilChanged.cs @@ -10,6 +10,13 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Returns an async-enumerable sequence that contains only distinct contiguous elements. + /// + /// The type of the elements in the source sequence. + /// An async-enumerable sequence to retain distinct contiguous elements for. + /// An async-enumerable sequence only containing the distinct contiguous elements from the source sequence. + /// is null. public static IAsyncEnumerable DistinctUntilChanged(this IAsyncEnumerable source) { if (source == null) @@ -18,6 +25,14 @@ public static IAsyncEnumerable DistinctUntilChanged(this IAsyn return DistinctUntilChangedCore(source, comparer: null); } + /// + /// Returns an async-enumerable sequence that contains only distinct contiguous elements according to the comparer. + /// + /// The type of the elements in the source sequence. + /// An async-enumerable sequence to retain distinct contiguous elements for. + /// Equality comparer for source elements. + /// An async-enumerable sequence only containing the distinct contiguous elements from the source sequence. + /// or is null. public static IAsyncEnumerable DistinctUntilChanged(this IAsyncEnumerable source, IEqualityComparer? comparer) { if (source == null) @@ -26,6 +41,15 @@ public static IAsyncEnumerable DistinctUntilChanged(this IAsyn return DistinctUntilChangedCore(source, comparer); } + /// + /// Returns an async-enumerable sequence that contains only distinct contiguous elements according to the keySelector. + /// + /// The type of the elements in the source sequence. + /// The type of the discriminator key computed for each element in the source sequence. + /// An async-enumerable sequence to retain distinct contiguous elements for, based on a computed key value. + /// A function to compute the comparison key for each element. + /// An async-enumerable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence. + /// or is null. public static IAsyncEnumerable DistinctUntilChanged(this IAsyncEnumerable source, Func keySelector) { if (source == null) @@ -36,6 +60,16 @@ public static IAsyncEnumerable DistinctUntilChanged(this IAsyn return DistinctUntilChangedCore(source, keySelector, comparer: null); } + /// + /// Returns an async-enumerable sequence that contains only distinct contiguous elements according to the keySelector and the comparer. + /// + /// The type of the elements in the source sequence. + /// The type of the discriminator key computed for each element in the source sequence. + /// An async-enumerable sequence to retain distinct contiguous elements for, based on a computed key value. + /// A function to compute the comparison key for each element. + /// Equality comparer for computed key values. + /// An async-enumerable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence. + /// or or is null. public static IAsyncEnumerable DistinctUntilChanged(this IAsyncEnumerable source, Func keySelector, IEqualityComparer? comparer) { if (source == null) @@ -46,6 +80,15 @@ public static IAsyncEnumerable DistinctUntilChanged(this IAsyn return DistinctUntilChangedCore(source, keySelector, comparer); } + /// + /// Returns an async-enumerable sequence that contains only distinct contiguous elements according to the asynchronous keySelector. + /// + /// The type of the elements in the source sequence. + /// The type of the discriminator key computed for each element in the source sequence. + /// An async-enumerable sequence to retain distinct contiguous elements for, based on a computed key value. + /// A function to compute the comparison key for each element asynchronously. + /// An async-enumerable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence. + /// or is null. public static IAsyncEnumerable DistinctUntilChanged(this IAsyncEnumerable source, Func> keySelector) { if (source == null) @@ -57,6 +100,15 @@ public static IAsyncEnumerable DistinctUntilChanged(this IAsyn } #if !NO_DEEP_CANCELLATION + /// + /// Returns an async-enumerable sequence that contains only distinct contiguous elements according to the asynchronous and cancellable keySelector. + /// + /// The type of the elements in the source sequence. + /// The type of the discriminator key computed for each element in the source sequence. + /// An async-enumerable sequence to retain distinct contiguous elements for, based on a computed key value. + /// A function to compute the comparison key for each element asynchronously while supporting cancellation. + /// An async-enumerable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence. + /// or is null. public static IAsyncEnumerable DistinctUntilChanged(this IAsyncEnumerable source, Func> keySelector) { if (source == null) @@ -68,6 +120,16 @@ public static IAsyncEnumerable DistinctUntilChanged(this IAsyn } #endif + /// + /// Returns an async-enumerable sequence that contains only distinct contiguous elements according to the asynchronous keySelector and the comparer. + /// + /// The type of the elements in the source sequence. + /// The type of the discriminator key computed for each element in the source sequence. + /// An async-enumerable sequence to retain distinct contiguous elements for, based on a computed key value. + /// A function to compute the comparison key for each element asynchronously. + /// Equality comparer for computed key values. + /// An async-enumerable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence. + /// or or is null. public static IAsyncEnumerable DistinctUntilChanged(this IAsyncEnumerable source, Func> keySelector, IEqualityComparer? comparer) { if (source == null) @@ -79,6 +141,16 @@ public static IAsyncEnumerable DistinctUntilChanged(this IAsyn } #if !NO_DEEP_CANCELLATION + /// + /// Returns an async-enumerable sequence that contains only distinct contiguous elements according to the asynchronous and cancellable keySelector and the comparer. + /// + /// The type of the elements in the source sequence. + /// The type of the discriminator key computed for each element in the source sequence. + /// An async-enumerable sequence to retain distinct contiguous elements for, based on a computed key value. + /// A function to compute the comparison key for each element asynchronously while supporting cancellation. + /// Equality comparer for computed key values. + /// An async-enumerable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence. + /// or or is null. public static IAsyncEnumerable DistinctUntilChanged(this IAsyncEnumerable source, Func> keySelector, IEqualityComparer comparer) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Do.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Do.cs index a13ad38ec8..b97c8f38f8 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Do.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Do.cs @@ -12,6 +12,15 @@ public static partial class AsyncEnumerableEx { // REVIEW: Should we convert Task-based overloads to ValueTask? + /// + /// Invokes an action for each element in the async-enumerable sequence, and propagates all observer messages through the result sequence. + /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. + /// + /// The type of the elements in the source sequence. + /// Source sequence. + /// Action to invoke for each element in the async-enumerable sequence. + /// The source sequence with the side-effecting behavior applied. + /// or is null. public static IAsyncEnumerable Do(this IAsyncEnumerable source, Action onNext) { if (source == null) @@ -22,6 +31,16 @@ public static IAsyncEnumerable Do(this IAsyncEnumerable + /// Invokes an action for each element in the async-enumerable sequence and invokes an action upon graceful termination of the async-enumerable sequence. + /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. + /// + /// The type of the elements in the source sequence. + /// Source sequence. + /// Action to invoke for each element in the async-enumerable sequence. + /// Action to invoke upon graceful termination of the async-enumerable sequence. + /// The source sequence with the side-effecting behavior applied. + /// or or is null. public static IAsyncEnumerable Do(this IAsyncEnumerable source, Action onNext, Action onCompleted) { if (source == null) @@ -34,6 +53,16 @@ public static IAsyncEnumerable Do(this IAsyncEnumerable + /// Invokes an action for each element in the async-enumerable sequence and invokes an action upon exceptional termination of the async-enumerable sequence. + /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. + /// + /// The type of the elements in the source sequence. + /// Source sequence. + /// Action to invoke for each element in the async-enumerable sequence. + /// Action to invoke upon exceptional termination of the async-enumerable sequence. + /// The source sequence with the side-effecting behavior applied. + /// or or is null. public static IAsyncEnumerable Do(this IAsyncEnumerable source, Action onNext, Action onError) { if (source == null) @@ -46,6 +75,17 @@ public static IAsyncEnumerable Do(this IAsyncEnumerable + /// Invokes an action for each element in the async-enumerable sequence and invokes an action upon graceful or exceptional termination of the async-enumerable sequence. + /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. + /// + /// The type of the elements in the source sequence. + /// Source sequence. + /// Action to invoke for each element in the async-enumerable sequence. + /// Action to invoke upon exceptional termination of the async-enumerable sequence. + /// Action to invoke upon graceful termination of the async-enumerable sequence. + /// The source sequence with the side-effecting behavior applied. + /// or or or is null. public static IAsyncEnumerable Do(this IAsyncEnumerable source, Action onNext, Action onError, Action onCompleted) { if (source == null) @@ -60,6 +100,15 @@ public static IAsyncEnumerable Do(this IAsyncEnumerable + /// Invokes and awaits an asynchronous action for each element in the async-enumerable sequence, and propagates all observer messages through the result sequence. + /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. + /// + /// The type of the elements in the source sequence. + /// Source sequence. + /// Action to invoke and await for each element in the async-enumerable sequence. + /// The source sequence with the side-effecting behavior applied. + /// or is null. public static IAsyncEnumerable Do(this IAsyncEnumerable source, Func onNext) { if (source == null) @@ -70,6 +119,16 @@ public static IAsyncEnumerable Do(this IAsyncEnumerable + /// Invokes and awaits an asynchronous action for each element in the async-enumerable sequence, then invokes and awaits an asynchronous an action upon graceful termination of the async-enumerable sequence. + /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. + /// + /// The type of the elements in the source sequence. + /// Source sequence. + /// Action to invoke and await for each element in the async-enumerable sequence. + /// Action to invoke and await upon graceful termination of the async-enumerable sequence. + /// The source sequence with the side-effecting behavior applied. + /// or or is null. public static IAsyncEnumerable Do(this IAsyncEnumerable source, Func onNext, Func onCompleted) { if (source == null) @@ -82,6 +141,16 @@ public static IAsyncEnumerable Do(this IAsyncEnumerable + /// Invokes and awaits an asynchronous action for each element in the async-enumerable sequence, then invokes and awaits an asynchronous action upon exceptional termination of the async-enumerable sequence. + /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. + /// + /// The type of the elements in the source sequence. + /// Source sequence. + /// Action to invoke and await for each element in the async-enumerable sequence. + /// Action to invoke and await upon exceptional termination of the async-enumerable sequence. + /// The source sequence with the side-effecting behavior applied. + /// or or is null. public static IAsyncEnumerable Do(this IAsyncEnumerable source, Func onNext, Func onError) { if (source == null) @@ -94,6 +163,17 @@ public static IAsyncEnumerable Do(this IAsyncEnumerable + /// Invokes and awaits an asynchronous action for each element in the async-enumerable sequence, then invokes and awaits an asynchronous action upon graceful or exceptional termination of the async-enumerable sequence. + /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. + /// + /// The type of the elements in the source sequence. + /// Source sequence. + /// Action to invoke and await for each element in the async-enumerable sequence. + /// Action to invoke and await upon exceptional termination of the async-enumerable sequence. + /// Action to invoke and await upon graceful termination of the async-enumerable sequence. + /// The source sequence with the side-effecting behavior applied. + /// or or or is null. public static IAsyncEnumerable Do(this IAsyncEnumerable source, Func onNext, Func onError, Func onCompleted) { if (source == null) @@ -109,6 +189,15 @@ public static IAsyncEnumerable Do(this IAsyncEnumerable + /// Invokes and awaits an asynchronous (cancellable) action for each element in the async-enumerable sequence, and propagates all observer messages through the result sequence. + /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. + /// + /// The type of the elements in the source sequence. + /// Source sequence. + /// Action to invoke and await for each element in the async-enumerable sequence while supporting cancellation. + /// The source sequence with the side-effecting behavior applied. + /// or is null. public static IAsyncEnumerable Do(this IAsyncEnumerable source, Func onNext) { if (source == null) @@ -119,6 +208,16 @@ public static IAsyncEnumerable Do(this IAsyncEnumerable + /// Invokes and awaits an asynchronous (cancellable) action for each element in the async-enumerable sequence, then invokes and awaits an asynchronous (cancellable) an action upon graceful termination of the async-enumerable sequence. + /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. + /// + /// The type of the elements in the source sequence. + /// Source sequence. + /// Action to invoke and await for each element in the async-enumerable sequence while supporting cancellation. + /// Action to invoke and await upon graceful termination of the async-enumerable sequence while supporting cancellation. + /// The source sequence with the side-effecting behavior applied. + /// or or is null. public static IAsyncEnumerable Do(this IAsyncEnumerable source, Func onNext, Func onCompleted) { if (source == null) @@ -131,6 +230,16 @@ public static IAsyncEnumerable Do(this IAsyncEnumerable + /// Invokes and awaits an asynchronous (cancellable) action for each element in the async-enumerable sequence, then invokes and awaits an asynchronous (cancellable) action upon exceptional termination of the async-enumerable sequence. + /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. + /// + /// The type of the elements in the source sequence. + /// Source sequence. + /// Action to invoke and await for each element in the async-enumerable sequence while supporting cancellation. + /// Action to invoke and await upon exceptional termination of the async-enumerable sequence while supporting cancellation. + /// The source sequence with the side-effecting behavior applied. + /// or or is null. public static IAsyncEnumerable Do(this IAsyncEnumerable source, Func onNext, Func onError) { if (source == null) @@ -143,6 +252,17 @@ public static IAsyncEnumerable Do(this IAsyncEnumerable + /// Invokes and awaits an asynchronous (cancellable) action for each element in the async-enumerable sequence, then invokes and awaits an asynchronous (cancellable) action upon graceful or exceptional termination of the async-enumerable sequence. + /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. + /// + /// The type of the elements in the source sequence. + /// Source sequence. + /// Action to invoke and await for each element in the async-enumerable sequence while supporting cancellation. + /// Action to invoke and await upon exceptional termination of the async-enumerable sequence while supporting cancellation. + /// Action to invoke and await upon graceful termination of the async-enumerable sequence while supporting cancellation. + /// The source sequence with the side-effecting behavior applied. + /// or or or is null. public static IAsyncEnumerable Do(this IAsyncEnumerable source, Func onNext, Func onError, Func onCompleted) { if (source == null) @@ -158,6 +278,15 @@ public static IAsyncEnumerable Do(this IAsyncEnumerable + /// Invokes the observer's methods for each message in the source async-enumerable sequence. + /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. + /// + /// The type of the elements in the source sequence. + /// Source sequence. + /// Observer whose methods to invoke as part of the source sequence's observation. + /// The source sequence with the side-effecting behavior applied. + /// or is null. public static IAsyncEnumerable Do(this IAsyncEnumerable source, IObserver observer) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Expand.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Expand.cs index 3574a7396e..361db62806 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Expand.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Expand.cs @@ -10,6 +10,13 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Expands (breadth first) the async-enumerable sequence by recursively applying a selector function to generate more sequences at each recursion level. + /// + /// Source sequence element type. + /// Source async-enumerable sequence. + /// Selector function to retrieve the next sequence to expand. + /// Sequence with results from the recursive expansion of the source sequence. public static IAsyncEnumerable Expand(this IAsyncEnumerable source, Func> selector) { if (source == null) @@ -37,6 +44,13 @@ await foreach (var item in queue.Dequeue().WithCancellation(cancellationToken).C } } + /// + /// Expands (breadth first) the async-enumerable sequence by recursively applying an asynchronous selector function to generate more sequences at each recursion level. + /// + /// Source sequence element type. + /// Source async-enumerable sequence. + /// Asynchronous selector function to retrieve the next sequence to expand. + /// Sequence with results from the recursive expansion of the source sequence. public static IAsyncEnumerable Expand(this IAsyncEnumerable source, Func>> selector) { if (source == null) @@ -65,6 +79,13 @@ await foreach (var item in queue.Dequeue().WithCancellation(cancellationToken).C } #if !NO_DEEP_CANCELLATION + /// + /// Expands (breadth first) the async-enumerable sequence by recursively applying an asynchronous (cancellable) selector function to generate more sequences at each recursion level. + /// + /// Source sequence element type. + /// Source async-enumerable sequence. + /// Asynchronous (cancellable) selector function to retrieve the next sequence to expand. + /// Sequence with results from the recursive expansion of the source sequence. public static IAsyncEnumerable Expand(this IAsyncEnumerable source, Func>> selector) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Finally.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Finally.cs index 46ed242765..11862c28c3 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Finally.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Finally.cs @@ -10,6 +10,14 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Invokes a specified action after the source async-enumerable sequence terminates gracefully or exceptionally. + /// + /// The type of the elements in the source sequence. + /// Source sequence. + /// Action to invoke after the source async-enumerable sequence terminates. + /// Source sequence with the action-invoking termination behavior applied. + /// or is null. public static IAsyncEnumerable Finally(this IAsyncEnumerable source, Action finallyAction) { if (source == null) @@ -35,6 +43,14 @@ await foreach (var item in source.WithCancellation(cancellationToken).ConfigureA } } + /// + /// Invokes a specified asynchronous action after the source async-enumerable sequence terminates gracefully or exceptionally. + /// + /// The type of the elements in the source sequence. + /// Source sequence. + /// Action to invoke and await asynchronously after the source async-enumerable sequence terminates. + /// Source sequence with the action-invoking termination behavior applied. + /// or is null. public static IAsyncEnumerable Finally(this IAsyncEnumerable source, Func finallyAction) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Generate.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Generate.cs index 2ac8feea91..ba62685463 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Generate.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Generate.cs @@ -11,6 +11,17 @@ public static partial class AsyncEnumerableEx { // REVIEW: Add async variant? + /// + /// Generates an async-enumerable sequence by running a state-driven loop producing the sequence's elements. + /// + /// The type of the state used in the generator loop. + /// The type of the elements in the produced sequence. + /// Initial state. + /// Condition to terminate generation (upon returning false). + /// Iteration step function. + /// Selector function for results produced in the sequence. + /// The generated sequence. + /// or or is null. public static IAsyncEnumerable Generate(TState initialState, Func condition, Func iterate, Func resultSelector) { if (condition == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/IgnoreElements.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/IgnoreElements.cs index 5e07037457..6f39cc95f4 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/IgnoreElements.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/IgnoreElements.cs @@ -10,6 +10,13 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Ignores all elements in an async-enumerable sequence leaving only the termination messages. + /// + /// The type of the elements in the source sequence. + /// Source sequence. + /// An empty async-enumerable sequence that signals termination, successful or exceptional, of the source sequence. + /// is null. public static IAsyncEnumerable IgnoreElements(this IAsyncEnumerable source) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/IsEmpty.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/IsEmpty.cs index 91bd30c144..06dcd4746e 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/IsEmpty.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/IsEmpty.cs @@ -10,6 +10,14 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Determines whether an async-enumerable sequence is empty. + /// + /// The type of the elements in the source sequence. + /// An async-enumerable sequence to check for emptiness. + /// The optional cancellation token to be used for cancelling the sequence at any time. + /// An async-enumerable sequence containing a single element determining whether the source sequence is empty. + /// is null. public static ValueTask IsEmptyAsync(this IAsyncEnumerable source, CancellationToken cancellationToken = default) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Max.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Max.cs index 08e88c3481..ad1cbfb030 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Max.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Max.cs @@ -10,6 +10,16 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Returns the maximum value in an async-enumerable sequence according to the specified comparer. + /// + /// The type of the elements in the source sequence. + /// An async-enumerable sequence to determine the maximum element of. + /// Comparer used to compare elements. + /// The optional cancellation token to be used for cancelling the sequence at any time. + /// An async-enumerable sequence containing a single element with the maximum element in the source sequence. + /// or is null. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask MaxAsync(this IAsyncEnumerable source, IComparer? comparer, CancellationToken cancellationToken = default) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/MaxBy.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/MaxBy.cs index 6097525d08..0f6e68c91c 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/MaxBy.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/MaxBy.cs @@ -10,6 +10,17 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Returns the elements in an async-enumerable sequence with the maximum key value. + /// + /// The type of the elements in the source sequence. + /// The type of the key computed for each element in the source sequence. + /// An async-enumerable sequence to get the maximum elements for. + /// Key selector function. + /// The optional cancellation token to be used for cancelling the sequence at any time. + /// A ValueTask containing a list of zero or more elements that have a maximum key value. + /// or is null. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> MaxByAsync(this IAsyncEnumerable source, Func keySelector, CancellationToken cancellationToken = default) { if (source == null) @@ -20,6 +31,18 @@ public static partial class AsyncEnumerableEx return MaxByCore(source, keySelector, comparer: null, cancellationToken); } + /// + /// Returns the elements in an async-enumerable sequence with the maximum key value according to the specified comparer. + /// + /// The type of the elements in the source sequence. + /// The type of the key computed for each element in the source sequence. + /// An async-enumerable sequence to get the maximum elements for. + /// Key selector function. + /// Comparer used to compare key values. + /// The optional cancellation token to be used for cancelling the sequence at any time. + /// A ValueTask containing a list of zero or more elements that have a maximum key value. + /// or or is null. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> MaxByAsync(this IAsyncEnumerable source, Func keySelector, IComparer? comparer, CancellationToken cancellationToken = default) { if (source == null) @@ -30,6 +53,17 @@ public static partial class AsyncEnumerableEx return MaxByCore(source, keySelector, comparer, cancellationToken); } + /// + /// Returns the elements in an async-enumerable sequence with the maximum key value. + /// + /// The type of the elements in the source sequence. + /// The type of the key computed for each element in the source sequence. + /// An async-enumerable sequence to get the maximum elements for. + /// Key selector function returning a key possibly asynchronously. + /// The optional cancellation token to be used for cancelling the sequence at any time. + /// A ValueTask containing a list of zero or more elements that have a maximum key value. + /// or is null. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> MaxByAsync(this IAsyncEnumerable source, Func> keySelector, CancellationToken cancellationToken = default) { if (source == null) @@ -41,6 +75,17 @@ public static partial class AsyncEnumerableEx } #if !NO_DEEP_CANCELLATION + /// + /// Returns the elements in an async-enumerable sequence with the maximum key value. + /// + /// The type of the elements in the source sequence. + /// The type of the key computed for each element in the source sequence. + /// An async-enumerable sequence to get the maximum elements for. + /// Key selector function returning a key possibly asynchronously and supporting cancellation. + /// The optional cancellation token to be used for cancelling the sequence at any time. + /// A ValueTask containing a list of zero or more elements that have a maximum key value. + /// or is null. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> MaxByAsync(this IAsyncEnumerable source, Func> keySelector, CancellationToken cancellationToken = default) { if (source == null) @@ -52,6 +97,18 @@ public static partial class AsyncEnumerableEx } #endif + /// + /// Returns the elements in an async-enumerable sequence with the maximum key value according to the specified comparer. + /// + /// The type of the elements in the source sequence. + /// The type of the key computed for each element in the source sequence. + /// An async-enumerable sequence to get the maximum elements for. + /// Key selector function returning a key possibly asynchronously. + /// Comparer used to compare key values. + /// The optional cancellation token to be used for cancelling the sequence at any time. + /// A ValueTask containing a list of zero or more elements that have a maximum key value. + /// or or is null. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> MaxByAsync(this IAsyncEnumerable source, Func> keySelector, IComparer? comparer, CancellationToken cancellationToken = default) { if (source == null) @@ -63,6 +120,18 @@ public static partial class AsyncEnumerableEx } #if !NO_DEEP_CANCELLATION + /// + /// Returns the elements in an async-enumerable sequence with the maximum key value according to the specified comparer. + /// + /// The type of the elements in the source sequence. + /// The type of the key computed for each element in the source sequence. + /// An async-enumerable sequence to get the maximum elements for. + /// Key selector function returning a key possibly asynchronously and supporting cancellation. + /// Comparer used to compare key values. + /// The optional cancellation token to be used for cancelling the sequence at any time. + /// A ValueTask containing a list of zero or more elements that have a maximum key value. + /// or or is null. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> MaxByAsync(this IAsyncEnumerable source, Func> keySelector, IComparer? comparer, CancellationToken cancellationToken = default) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Merge.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Merge.cs index 1273619bd2..4dd10c2a29 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Merge.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Merge.cs @@ -10,6 +10,13 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Merges elements from all of the specified async-enumerable sequences into a single async-enumerable sequence. + /// + /// The type of the elements in the source sequences. + /// Observable sequences. + /// The async-enumerable sequence that merges the elements of the async-enumerable sequences. + /// is null. public static IAsyncEnumerable Merge(params IAsyncEnumerable[] sources) { if (sources == null) @@ -296,6 +303,13 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) #endif } + /// + /// Merges elements from all async-enumerable sequences in the given enumerable sequence into a single async-enumerable sequence. + /// + /// The type of the elements in the source sequences. + /// Enumerable sequence of async-enumerable sequences. + /// The async-enumerable sequence that merges the elements of the async-enumerable sequences. + /// is null. public static IAsyncEnumerable Merge(this IEnumerable> sources) { if (sources == null) @@ -323,6 +337,13 @@ public static IAsyncEnumerable Merge(this IEnumerable source); } + /// + /// Merges elements from all inner async-enumerable sequences into a single async-enumerable sequence. + /// + /// The type of the elements in the source sequences. + /// Observable sequence of inner async-enumerable sequences. + /// The async-enumerable sequence that merges the elements of the inner sequences. + /// is null. public static IAsyncEnumerable Merge(this IAsyncEnumerable> sources) { if (sources == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Min.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Min.cs index 36d10a99a4..348b465484 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Min.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Min.cs @@ -10,6 +10,16 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Returns the minimum element in an async-enumerable sequence according to the specified comparer. + /// + /// The type of the elements in the source sequence. + /// An async-enumerable sequence to determine the minimum element of. + /// Comparer used to compare elements. + /// The optional cancellation token to be used for cancelling the sequence at any time. + /// An async-enumerable sequence containing a single element with the minimum element in the source sequence. + /// or is null. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask MinAsync(this IAsyncEnumerable source, IComparer? comparer, CancellationToken cancellationToken = default) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/MinBy.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/MinBy.cs index 75398e47b2..25b7364d69 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/MinBy.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/MinBy.cs @@ -10,6 +10,17 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Returns the elements in an async-enumerable sequence with the minimum key value. + /// + /// The type of the elements in the source sequence. + /// The type of the key computed for each element in the source sequence. + /// An async-enumerable sequence to get the minimum elements for. + /// Key selector function. + /// The optional cancellation token to be used for cancelling the sequence at any time. + /// A ValueTask containing a list of zero or more elements that have a minimum key value. + /// or is null. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> MinByAsync(this IAsyncEnumerable source, Func keySelector, CancellationToken cancellationToken = default) { if (source == null) @@ -20,6 +31,18 @@ public static partial class AsyncEnumerableEx return MinByCore(source, keySelector, comparer: null, cancellationToken); } + /// + /// Returns the elements in an async-enumerable sequence with the minimum key value according to the specified comparer. + /// + /// The type of the elements in the source sequence. + /// The type of the key computed for each element in the source sequence. + /// An async-enumerable sequence to get the minimum elements for. + /// Key selector function. + /// Comparer used to compare key values. + /// The optional cancellation token to be used for cancelling the sequence at any time. + /// A ValueTask containing a list of zero or more elements that have a minimum key value. + /// or or is null. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> MinByAsync(this IAsyncEnumerable source, Func keySelector, IComparer? comparer, CancellationToken cancellationToken = default) { if (source == null) @@ -30,6 +53,17 @@ public static partial class AsyncEnumerableEx return MinByCore(source, keySelector, comparer, cancellationToken); } + /// + /// Returns the elements in an async-enumerable sequence with the minimum key value. + /// + /// The type of the elements in the source sequence. + /// The type of the key computed for each element in the source sequence. + /// An async-enumerable sequence to get the minimum elements for. + /// Key selector function returning a key possibly asynchronously. + /// The optional cancellation token to be used for cancelling the sequence at any time. + /// A ValueTask containing a list of zero or more elements that have a minimum key value. + /// or is null. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> MinByAsync(this IAsyncEnumerable source, Func> keySelector, CancellationToken cancellationToken = default) { if (source == null) @@ -41,6 +75,17 @@ public static partial class AsyncEnumerableEx } #if !NO_DEEP_CANCELLATION + /// + /// Returns the elements in an async-enumerable sequence with the minimum key value. + /// + /// The type of the elements in the source sequence. + /// The type of the key computed for each element in the source sequence. + /// An async-enumerable sequence to get the minimum elements for. + /// Key selector function returning a key possibly asynchronously and supporting cancellation. + /// The optional cancellation token to be used for cancelling the sequence at any time. + /// A ValueTask containing a list of zero or more elements that have a minimum key value. + /// or is null. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> MinByAsync(this IAsyncEnumerable source, Func> keySelector, CancellationToken cancellationToken = default) { if (source == null) @@ -52,6 +97,18 @@ public static partial class AsyncEnumerableEx } #endif + /// + /// Returns the elements in an async-enumerable sequence with the minimum key value according to the specified comparer. + /// + /// The type of the elements in the source sequence. + /// The type of the key computed for each element in the source sequence. + /// An async-enumerable sequence to get the minimum elements for. + /// Key selector function returning a key possibly asynchronously. + /// Comparer used to compare key values. + /// The optional cancellation token to be used for cancelling the sequence at any time. + /// A ValueTask containing a list of zero or more elements that have a minimum key value. + /// or or is null. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> MinByAsync(this IAsyncEnumerable source, Func> keySelector, IComparer? comparer, CancellationToken cancellationToken = default) { if (source == null) @@ -63,6 +120,18 @@ public static partial class AsyncEnumerableEx } #if !NO_DEEP_CANCELLATION + /// + /// Returns the elements in an async-enumerable sequence with the minimum key value according to the specified comparer. + /// + /// The type of the elements in the source sequence. + /// The type of the key computed for each element in the source sequence. + /// An async-enumerable sequence to get the minimum elements for. + /// Key selector function returning a key possibly asynchronously and supporting cancellation. + /// Comparer used to compare key values. + /// The optional cancellation token to be used for cancelling the sequence at any time. + /// A ValueTask containing a list of zero or more elements that have a minimum key value. + /// or or is null. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> MinByAsync(this IAsyncEnumerable source, Func> keySelector, IComparer comparer, CancellationToken cancellationToken = default) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Never.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Never.cs index 969e2177d9..e5381b7de1 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Never.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Never.cs @@ -10,6 +10,11 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Returns a non-terminating async-enumerable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins). + /// + /// The type used for the type parameter of the resulting sequence. + /// An async-enumerable sequence whose consumers will never resume after awaiting . public static IAsyncEnumerable Never() => NeverAsyncEnumerable.Instance; private sealed class NeverAsyncEnumerable : IAsyncEnumerable diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/OnErrorResumeNext.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/OnErrorResumeNext.cs index 00ac599fb5..cec1d72f2e 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/OnErrorResumeNext.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/OnErrorResumeNext.cs @@ -9,6 +9,14 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Concatenates the second async-enumerable sequence to the first async-enumerable sequence upon successful or exceptional termination of the first. + /// + /// The type of the elements in the source sequences. + /// First async-enumerable sequence whose exception (if any) is caught. + /// Second async-enumerable sequence used to produce results after the first sequence terminates. + /// An async-enumerable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally. + /// or is null. public static IAsyncEnumerable OnErrorResumeNext(this IAsyncEnumerable first, IAsyncEnumerable second) { if (first == null) @@ -19,6 +27,13 @@ public static IAsyncEnumerable OnErrorResumeNext(this IAsyncEn return OnErrorResumeNextCore(new[] { first, second }); } + /// + /// Concatenates all of the specified async-enumerable sequences, even if the previous async-enumerable sequence terminated exceptionally. + /// + /// The type of the elements in the source sequences. + /// Observable sequences to concatenate. + /// An async-enumerable sequence that concatenates the source sequences, even if a sequence terminates exceptionally. + /// is null. public static IAsyncEnumerable OnErrorResumeNext(params IAsyncEnumerable[] sources) { if (sources == null) @@ -27,6 +42,13 @@ public static IAsyncEnumerable OnErrorResumeNext(params IAsync return OnErrorResumeNextCore(sources); } + /// + /// Concatenates all async-enumerable sequences in the given enumerable sequence, even if the previous async-enumerable sequence terminated exceptionally. + /// + /// The type of the elements in the source sequences. + /// Observable sequences to concatenate. + /// An async-enumerable sequence that concatenates the source sequences, even if a sequence terminates exceptionally. + /// is null. public static IAsyncEnumerable OnErrorResumeNext(this IEnumerable> sources) { if (sources == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Repeat.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Repeat.cs index 3c5c05c732..82f2f880f7 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Repeat.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Repeat.cs @@ -10,6 +10,12 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Repeats the element indefinitely. + /// + /// The type of the elements in the source sequence. + /// Element to repeat. + /// The async-enumerable sequence producing the element repeatedly and sequentially. public static IAsyncEnumerable Repeat(TResult element) { return AsyncEnumerable.Create(Core); @@ -27,6 +33,13 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) #pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously } + /// + /// Repeats the async-enumerable sequence indefinitely. + /// + /// The type of the elements in the source sequence. + /// Observable sequence to repeat. + /// The async-enumerable sequence producing the elements of the given sequence repeatedly and sequentially. + /// is null. public static IAsyncEnumerable Repeat(this IAsyncEnumerable source) { if (source == null) @@ -46,6 +59,15 @@ await foreach (var item in source.WithCancellation(cancellationToken).ConfigureA } } + /// + /// Repeats the async-enumerable sequence a specified number of times. + /// + /// The type of the elements in the source sequence. + /// Observable sequence to repeat. + /// Number of times to repeat the sequence. + /// The async-enumerable sequence producing the elements of the given sequence repeatedly. + /// is null. + /// is less than zero. public static IAsyncEnumerable Repeat(this IAsyncEnumerable source, int count) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Retry.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Retry.cs index 8ef41c117c..228618533d 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Retry.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Retry.cs @@ -8,6 +8,13 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Repeats the source async-enumerable sequence until it successfully terminates. + /// + /// The type of the elements in the source sequence. + /// Observable sequence to repeat until it successfully terminates. + /// An async-enumerable sequence producing the elements of the given sequence repeatedly until it terminates successfully. + /// is null. public static IAsyncEnumerable Retry(this IAsyncEnumerable source) { if (source == null) @@ -16,6 +23,15 @@ public static IAsyncEnumerable Retry(this IAsyncEnumerable + /// Repeats the source async-enumerable sequence the specified number of times or until it successfully terminates. + /// + /// The type of the elements in the source sequence. + /// Observable sequence to repeat until it successfully terminates. + /// Number of times to repeat the sequence. + /// An async-enumerable sequence producing the elements of the given sequence repeatedly until it terminates successfully. + /// is null. + /// is less than zero. public static IAsyncEnumerable Retry(this IAsyncEnumerable source, int retryCount) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Return.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Return.cs index e8d7621d1c..65ce406e43 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Return.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Return.cs @@ -10,6 +10,12 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Returns an async-enumerable sequence that contains a single element. + /// + /// The type of the element that will be returned in the produced sequence. + /// Single element in the resulting async-enumerable sequence. + /// An async-enumerable sequence containing the single specified element. public static IAsyncEnumerable Return(TValue value) => new ReturnEnumerable(value); // REVIEW: Add support for IAsyncPartition. diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Scan.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Scan.cs index 7f403d8d45..4dd1c2ee36 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Scan.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Scan.cs @@ -14,6 +14,15 @@ public static partial class AsyncEnumerableEx // element, which returns the first element (or the seed if given an empty sequence). This is compatible with Rx // but one could argue whether it was the right default. + /// + /// Applies an accumulator function over an async-enumerable sequence and returns each intermediate result. + /// For aggregation behavior with no intermediate results, see . + /// + /// The type of the elements in the source sequence and the result of the aggregation. + /// An async-enumerable sequence to accumulate over. + /// An accumulator function to be invoked on each element. + /// An async-enumerable sequence containing the accumulated values. + /// or is null. public static IAsyncEnumerable Scan(this IAsyncEnumerable source, Func accumulator) { if (source == null) @@ -43,6 +52,17 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) } } + /// + /// Applies an accumulator function over an async-enumerable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value. + /// For aggregation behavior with no intermediate results, see . + /// + /// The type of the elements in the source sequence. + /// The type of the result of the aggregation. + /// An async-enumerable sequence to accumulate over. + /// The initial accumulator value. + /// An accumulator function to be invoked on each element. + /// An async-enumerable sequence containing the accumulated values. + /// or is null. public static IAsyncEnumerable Scan(this IAsyncEnumerable source, TAccumulate seed, Func accumulator) { if (source == null) @@ -65,6 +85,15 @@ await foreach (var item in source.WithCancellation(cancellationToken).ConfigureA } } + /// + /// Applies an asynchronous accumulator function over an async-enumerable sequence and returns each intermediate result. + /// For aggregation behavior with no intermediate results, see . + /// + /// The type of the elements in the source sequence and the result of the aggregation. + /// An async-enumerable sequence to accumulate over. + /// An asynchronous accumulator function to be invoked and awaited on each element. + /// An async-enumerable sequence containing the accumulated values. + /// or is null. public static IAsyncEnumerable Scan(this IAsyncEnumerable source, Func> accumulator) { if (source == null) @@ -95,6 +124,15 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) } #if !NO_DEEP_CANCELLATION + /// + /// Applies an asynchronous (cancellable) accumulator function over an async-enumerable sequence and returns each intermediate result. + /// For aggregation behavior with no intermediate results, see . + /// + /// The type of the elements in the source sequence and the result of the aggregation. + /// An async-enumerable sequence to accumulate over. + /// An asynchronous (cancellable) accumulator function to be invoked and awaited on each element. + /// An async-enumerable sequence containing the accumulated values. + /// or is null. public static IAsyncEnumerable Scan(this IAsyncEnumerable source, Func> accumulator) { if (source == null) @@ -125,6 +163,17 @@ async IAsyncEnumerator Core(CancellationToken cancellationToken) } #endif + /// + /// Applies an asynchronous accumulator function over an async-enumerable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value. + /// For aggregation behavior with no intermediate results, see . + /// + /// The type of the elements in the source sequence. + /// The type of the result of the aggregation. + /// An async-enumerable sequence to accumulate over. + /// The initial accumulator value. + /// An asynchronous accumulator function to be invoked on each element. + /// An async-enumerable sequence containing the accumulated values. + /// or is null. public static IAsyncEnumerable Scan(this IAsyncEnumerable source, TAccumulate seed, Func> accumulator) { if (source == null) @@ -148,6 +197,17 @@ await foreach (var item in source.WithCancellation(cancellationToken).ConfigureA } #if !NO_DEEP_CANCELLATION + /// + /// Applies an asynchronous (cancellable) accumulator function over an async-enumerable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value. + /// For aggregation behavior with no intermediate results, see . + /// + /// The type of the elements in the source sequence. + /// The type of the result of the aggregation. + /// An async-enumerable sequence to accumulate over. + /// The initial accumulator value. + /// An asynchronous (cancellable) accumulator function to be invoked on each element. + /// An async-enumerable sequence containing the accumulated values. + /// or is null. public static IAsyncEnumerable Scan(this IAsyncEnumerable source, TAccumulate seed, Func> accumulator) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/SelectMany.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/SelectMany.cs index be1c3f8076..8679d667e3 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/SelectMany.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/SelectMany.cs @@ -8,6 +8,15 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Projects each element of the source async-enumerable sequence to the other async-enumerable sequence and merges the resulting async-enumerable sequences into one async-enumerable sequence. + /// + /// The type of the elements in the source sequence. + /// The type of the elements in the other sequence and the elements in the result sequence. + /// An async-enumerable sequence of elements to project. + /// An async-enumerable sequence to project each element from the source sequence onto. + /// An async-enumerable sequence whose elements are the result of projecting each source element onto the other sequence and merging all the resulting sequences together. + /// or is null. public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, IAsyncEnumerable other) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/StartWith.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/StartWith.cs index 4376308702..2f3669b2f6 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/StartWith.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/StartWith.cs @@ -11,6 +11,14 @@ public static partial class AsyncEnumerableEx // REVIEW: This is really an n-ary Prepend. Should we add n-ary overloads of Append and Prepend as well? // If so, likely in Ix rather than System.Linq.Async. + /// + /// Prepends a sequence of values to an async-enumerable sequence. + /// + /// The type of the elements in the source sequence. + /// Source sequence to prepend values to. + /// Values to prepend to the specified sequence. + /// The source sequence prepended with the specified values. + /// or is null. public static IAsyncEnumerable StartWith(this IAsyncEnumerable source, params TSource[] values) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Throw.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Throw.cs index be4b6603f7..0a510f66f2 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Throw.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Throw.cs @@ -10,6 +10,13 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Returns an async-enumerable sequence that terminates with an exception. + /// + /// The type used for the type parameter of the resulting sequence. + /// Exception object used for the sequence's termination. + /// The async-enumerable sequence that terminates exceptionally with the specified exception object. + /// is null. public static IAsyncEnumerable Throw(Exception exception) { if (exception == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Timeout.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Timeout.cs index 5c84398abf..5db1402141 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Timeout.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Timeout.cs @@ -10,6 +10,33 @@ namespace System.Linq { public static partial class AsyncEnumerableEx { + /// + /// Applies a timeout policy for each element in the async-enumerable sequence. + /// If the next element isn't received within the specified timeout duration starting from its predecessor, a TimeoutException is propagated to the observer. + /// + /// The type of the elements in the source sequence. + /// Source sequence to perform a timeout for. + /// Maximum duration between values before a timeout occurs. + /// The source sequence with a TimeoutException in case of a timeout. + /// is null. + /// is less than TimeSpan.Zero. + /// (Asynchronous) If no element is produced within from the previous element. + /// + /// + /// In case you only want to timeout on the first element, consider using the + /// operator applied to the source sequence and a delayed sequence. + /// + /// + /// + /// Specifying a TimeSpan.Zero value for is not recommended but supported, causing timeout timers to be scheduled that are due + /// immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the + /// scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may + /// arrive before the scheduler gets a chance to run the timeout action. + /// + /// public static IAsyncEnumerable Timeout(this IAsyncEnumerable source, TimeSpan timeout) { if (source == null) diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Using.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Using.cs index 0eea72313d..8168ffe0fe 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Using.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Using.cs @@ -12,6 +12,15 @@ public static partial class AsyncEnumerableEx { // REVIEW: Add support for IAsyncDisposable resources. + /// + /// Constructs an async-enumerable sequence that depends on a resource object, whose lifetime is tied to the resulting async-enumerable sequence's lifetime. + /// + /// The type of the elements in the produced sequence. + /// The type of the resource used during the generation of the resulting sequence. Needs to implement . + /// Factory function to obtain a resource object. + /// Factory function to obtain an async-enumerable sequence that depends on the obtained resource. + /// An async-enumerable sequence whose lifetime controls the lifetime of the dependent resource object. + /// or is null. public static IAsyncEnumerable Using(Func resourceFactory, Func> enumerableFactory) where TResource : IDisposable { if (resourceFactory == null) @@ -32,6 +41,17 @@ await foreach (var item in enumerableFactory(resource).WithCancellation(cancella } } + /// + /// Constructs an async-enumerable sequence that depends on a resource object, whose lifetime is tied to the resulting async-enumerable sequence's lifetime. + /// + /// The type of the elements in the produced sequence. + /// The type of the resource used during the generation of the resulting sequence. Needs to implement . + /// Asynchronous factory function to obtain a resource object. + /// Asynchronous factory function to obtain an async-enumerable sequence that depends on the obtained resource. + /// An async-enumerable sequence whose lifetime controls the lifetime of the dependent resource object. + /// or is null. + /// This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11. + /// When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous resource factory and async-enumerable factory functions will be signaled. public static IAsyncEnumerable Using(Func> resourceFactory, Func>> enumerableFactory) where TResource : IDisposable { if (resourceFactory == null) @@ -53,6 +73,18 @@ await foreach (var item in (await enumerableFactory(resource).ConfigureAwait(fal } #if !NO_DEEP_CANCELLATION + /// + /// Constructs an async-enumerable sequence that depends on a resource object, whose lifetime is tied to the resulting async-enumerable sequence's lifetime. The resource is obtained and used through asynchronous methods. + /// The CancellationToken passed to the asynchronous methods is tied to the returned disposable subscription, allowing best-effort cancellation at any stage of the resource acquisition or usage. + /// + /// The type of the elements in the produced sequence. + /// The type of the resource used during the generation of the resulting sequence. Needs to implement . + /// Asynchronous factory function to obtain a resource object. + /// Asynchronous factory function to obtain an async-enumerable sequence that depends on the obtained resource. + /// An async-enumerable sequence whose lifetime controls the lifetime of the dependent resource object. + /// or is null. + /// This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11. + /// When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous resource factory and async-enumerable factory functions will be signaled. public static IAsyncEnumerable Using(Func> resourceFactory, Func>> enumerableFactory) where TResource : IDisposable { if (resourceFactory == null)