|
@@ -953,6 +953,30 @@ namespace System.Reactive.Linq
|
|
|
return s_impl.StartAsync<TResult>(functionAsync);
|
|
return s_impl.StartAsync<TResult>(functionAsync);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Invokes the asynchronous function, surfacing the result through an observable sequence.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
|
|
|
|
|
+ /// <param name="functionAsync">Asynchronous function to run.</param>
|
|
|
|
|
+ /// <param name="scheduler">Scheduler on which to notify observers.</param>
|
|
|
|
|
+ /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
|
|
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="functionAsync"/> is null or <paramref name="scheduler"/> is null.</exception>
|
|
|
|
|
+ /// <remarks>
|
|
|
|
|
+ /// <list type="bullet">
|
|
|
|
|
+ /// <item><description>The function is started immediately, not during the subscription of the resulting sequence.</description></item>
|
|
|
|
|
+ /// <item><description>Multiple subscriptions to the resulting sequence can observe the function's result.</description></item>
|
|
|
|
|
+ /// </list>
|
|
|
|
|
+ /// </remarks>
|
|
|
|
|
+ public static IObservable<TResult> StartAsync<TResult>(Func<Task<TResult>> functionAsync, IScheduler scheduler)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (functionAsync == null)
|
|
|
|
|
+ throw new ArgumentNullException("functionAsync");
|
|
|
|
|
+ if (scheduler == null)
|
|
|
|
|
+ throw new ArgumentNullException("scheduler");
|
|
|
|
|
+
|
|
|
|
|
+ return s_impl.StartAsync<TResult>(functionAsync, scheduler);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Invokes the asynchronous function, surfacing the result through an observable sequence.
|
|
/// Invokes the asynchronous function, surfacing the result through an observable sequence.
|
|
|
/// The CancellationToken is shared by all subscriptions on the resulting observable sequence. See the remarks section for more information.
|
|
/// The CancellationToken is shared by all subscriptions on the resulting observable sequence. See the remarks section for more information.
|
|
@@ -981,6 +1005,38 @@ namespace System.Reactive.Linq
|
|
|
|
|
|
|
|
return s_impl.StartAsync<TResult>(functionAsync);
|
|
return s_impl.StartAsync<TResult>(functionAsync);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Invokes the asynchronous function, surfacing the result through an observable sequence.
|
|
|
|
|
+ /// The CancellationToken is shared by all subscriptions on the resulting observable sequence. See the remarks section for more information.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
|
|
|
|
|
+ /// <param name="functionAsync">Asynchronous function to run.</param>
|
|
|
|
|
+ /// <param name="scheduler">Scheduler on which to notify observers.</param>
|
|
|
|
|
+ /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
|
|
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="functionAsync"/> is null or <paramref name="scheduler"/> is null.</exception>
|
|
|
|
|
+ /// <remarks>
|
|
|
|
|
+ /// <list type="bullet">
|
|
|
|
|
+ /// <item><description>The function is started immediately, not during the subscription of the resulting sequence.</description></item>
|
|
|
|
|
+ /// <item><description>Multiple subscriptions to the resulting sequence can observe the function's result.</description></item>
|
|
|
|
|
+ /// <item><description>
|
|
|
|
|
+ /// If any subscription to the resulting sequence is disposed, the CancellationToken is set. The observer associated to the disposed
|
|
|
|
|
+ /// subscription won't see the TaskCanceledException, but other observers will. You can protect against this using the Catch operator.
|
|
|
|
|
+ /// Be careful when handing out the resulting sequence because of this behavior. The most common use is to have a single subscription
|
|
|
|
|
+ /// to the resulting sequence, which controls the CancellationToken state. Alternatively, you can control subscription behavior using
|
|
|
|
|
+ /// multicast operators.
|
|
|
|
|
+ /// </description></item>
|
|
|
|
|
+ /// </list>
|
|
|
|
|
+ /// </remarks>
|
|
|
|
|
+ public static IObservable<TResult> StartAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync, IScheduler scheduler)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (functionAsync == null)
|
|
|
|
|
+ throw new ArgumentNullException("functionAsync");
|
|
|
|
|
+ if (scheduler == null)
|
|
|
|
|
+ throw new ArgumentNullException("scheduler");
|
|
|
|
|
+
|
|
|
|
|
+ return s_impl.StartAsync<TResult>(functionAsync, scheduler);
|
|
|
|
|
+ }
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
#endregion
|
|
#endregion
|
|
@@ -1051,6 +1107,29 @@ namespace System.Reactive.Linq
|
|
|
return s_impl.StartAsync(actionAsync);
|
|
return s_impl.StartAsync(actionAsync);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Invokes the asynchronous action, surfacing the result through an observable sequence.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <param name="actionAsync">Asynchronous action to run.</param>
|
|
|
|
|
+ /// <param name="scheduler">Scheduler on which to notify observers.</param>
|
|
|
|
|
+ /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
|
|
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="actionAsync"/> is null or <paramref name="scheduler"/> is null.</exception>
|
|
|
|
|
+ /// <remarks>
|
|
|
|
|
+ /// <list type="bullet">
|
|
|
|
|
+ /// <item><description>The action is started immediately, not during the subscription of the resulting sequence.</description></item>
|
|
|
|
|
+ /// <item><description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description></item>
|
|
|
|
|
+ /// </list>
|
|
|
|
|
+ /// </remarks>
|
|
|
|
|
+ public static IObservable<Unit> StartAsync(Func<Task> actionAsync, IScheduler scheduler)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (actionAsync == null)
|
|
|
|
|
+ throw new ArgumentNullException("actionAsync");
|
|
|
|
|
+ if (scheduler == null)
|
|
|
|
|
+ throw new ArgumentNullException("scheduler");
|
|
|
|
|
+
|
|
|
|
|
+ return s_impl.StartAsync(actionAsync, scheduler);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Invokes the asynchronous action, surfacing the result through an observable sequence.
|
|
/// Invokes the asynchronous action, surfacing the result through an observable sequence.
|
|
|
/// The CancellationToken is shared by all subscriptions on the resulting observable sequence. See the remarks section for more information.
|
|
/// The CancellationToken is shared by all subscriptions on the resulting observable sequence. See the remarks section for more information.
|
|
@@ -1078,6 +1157,37 @@ namespace System.Reactive.Linq
|
|
|
|
|
|
|
|
return s_impl.StartAsync(actionAsync);
|
|
return s_impl.StartAsync(actionAsync);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Invokes the asynchronous action, surfacing the result through an observable sequence.
|
|
|
|
|
+ /// The CancellationToken is shared by all subscriptions on the resulting observable sequence. See the remarks section for more information.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <param name="actionAsync">Asynchronous action to run.</param>
|
|
|
|
|
+ /// <param name="scheduler">Scheduler on which to notify observers.</param>
|
|
|
|
|
+ /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
|
|
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="actionAsync"/> is null or <paramref name="scheduler"/> is null.</exception>
|
|
|
|
|
+ /// <remarks>
|
|
|
|
|
+ /// <list type="bullet">
|
|
|
|
|
+ /// <item><description>The action is started immediately, not during the subscription of the resulting sequence.</description></item>
|
|
|
|
|
+ /// <item><description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description></item>
|
|
|
|
|
+ /// <item><description>
|
|
|
|
|
+ /// If any subscription to the resulting sequence is disposed, the CancellationToken is set. The observer associated to the disposed
|
|
|
|
|
+ /// subscription won't see the TaskCanceledException, but other observers will. You can protect against this using the Catch operator.
|
|
|
|
|
+ /// Be careful when handing out the resulting sequence because of this behavior. The most common use is to have a single subscription
|
|
|
|
|
+ /// to the resulting sequence, which controls the CancellationToken state. Alternatively, you can control subscription behavior using
|
|
|
|
|
+ /// multicast operators.
|
|
|
|
|
+ /// </description></item>
|
|
|
|
|
+ /// </list>
|
|
|
|
|
+ /// </remarks>
|
|
|
|
|
+ public static IObservable<Unit> StartAsync(Func<CancellationToken, Task> actionAsync, IScheduler scheduler)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (actionAsync == null)
|
|
|
|
|
+ throw new ArgumentNullException("actionAsync");
|
|
|
|
|
+ if (scheduler == null)
|
|
|
|
|
+ throw new ArgumentNullException("scheduler");
|
|
|
|
|
+
|
|
|
|
|
+ return s_impl.StartAsync(actionAsync, scheduler);
|
|
|
|
|
+ }
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
#endregion
|
|
#endregion
|
|
@@ -1099,9 +1209,30 @@ namespace System.Reactive.Linq
|
|
|
/// <exception cref="ArgumentNullException"><paramref name="functionAsync"/> is null.</exception>
|
|
/// <exception cref="ArgumentNullException"><paramref name="functionAsync"/> is null.</exception>
|
|
|
public static IObservable<TResult> FromAsync<TResult>(Func<Task<TResult>> functionAsync)
|
|
public static IObservable<TResult> FromAsync<TResult>(Func<Task<TResult>> functionAsync)
|
|
|
{
|
|
{
|
|
|
|
|
+ if (functionAsync == null)
|
|
|
|
|
+ throw new ArgumentNullException("functionAsync");
|
|
|
|
|
+
|
|
|
return s_impl.FromAsync<TResult>(functionAsync);
|
|
return s_impl.FromAsync<TResult>(functionAsync);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Converts to asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
|
|
|
|
|
+ /// <param name="functionAsync">Asynchronous function to convert.</param>
|
|
|
|
|
+ /// <param name="scheduler">Scheduler on which to notify observers.</param>
|
|
|
|
|
+ /// <returns>An observable sequence exposing the result of invoking the function, or an exception.</returns>
|
|
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="functionAsync"/> is null or <paramref name="scheduler"/> is null.</exception>
|
|
|
|
|
+ public static IObservable<TResult> FromAsync<TResult>(Func<Task<TResult>> functionAsync, IScheduler scheduler)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (functionAsync == null)
|
|
|
|
|
+ throw new ArgumentNullException("functionAsync");
|
|
|
|
|
+ if (scheduler == null)
|
|
|
|
|
+ throw new ArgumentNullException("scheduler");
|
|
|
|
|
+
|
|
|
|
|
+ return s_impl.FromAsync<TResult>(functionAsync, scheduler);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Converts to asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started.
|
|
/// Converts to asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started.
|
|
|
/// The CancellationToken passed to the asynchronous function is tied to the observable sequence's subscription that triggered the function's invocation and can be used for best-effort cancellation.
|
|
/// The CancellationToken passed to the asynchronous function is tied to the observable sequence's subscription that triggered the function's invocation and can be used for best-effort cancellation.
|
|
@@ -1113,9 +1244,32 @@ namespace System.Reactive.Linq
|
|
|
/// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.</remarks>
|
|
/// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.</remarks>
|
|
|
public static IObservable<TResult> FromAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync)
|
|
public static IObservable<TResult> FromAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync)
|
|
|
{
|
|
{
|
|
|
|
|
+ if (functionAsync == null)
|
|
|
|
|
+ throw new ArgumentNullException("functionAsync");
|
|
|
|
|
+
|
|
|
return s_impl.FromAsync<TResult>(functionAsync);
|
|
return s_impl.FromAsync<TResult>(functionAsync);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Converts to asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started.
|
|
|
|
|
+ /// The CancellationToken passed to the asynchronous function is tied to the observable sequence's subscription that triggered the function's invocation and can be used for best-effort cancellation.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
|
|
|
|
|
+ /// <param name="functionAsync">Asynchronous function to convert.</param>
|
|
|
|
|
+ /// <param name="scheduler">Scheduler on which to notify observers.</param>
|
|
|
|
|
+ /// <returns>An observable sequence exposing the result of invoking the function, or an exception.</returns>
|
|
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="functionAsync"/> is null or <paramref name="scheduler"/> is null.</exception>
|
|
|
|
|
+ /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.</remarks>
|
|
|
|
|
+ public static IObservable<TResult> FromAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync, IScheduler scheduler)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (functionAsync == null)
|
|
|
|
|
+ throw new ArgumentNullException("functionAsync");
|
|
|
|
|
+ if (scheduler == null)
|
|
|
|
|
+ throw new ArgumentNullException("scheduler");
|
|
|
|
|
+
|
|
|
|
|
+ return s_impl.FromAsync<TResult>(functionAsync, scheduler);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
#region Action
|
|
#region Action
|
|
@@ -1128,9 +1282,29 @@ namespace System.Reactive.Linq
|
|
|
/// <exception cref="ArgumentNullException"><paramref name="actionAsync"/> is null.</exception>
|
|
/// <exception cref="ArgumentNullException"><paramref name="actionAsync"/> is null.</exception>
|
|
|
public static IObservable<Unit> FromAsync(Func<Task> actionAsync)
|
|
public static IObservable<Unit> FromAsync(Func<Task> actionAsync)
|
|
|
{
|
|
{
|
|
|
|
|
+ if (actionAsync == null)
|
|
|
|
|
+ throw new ArgumentNullException("actionAsync");
|
|
|
|
|
+
|
|
|
return s_impl.FromAsync(actionAsync);
|
|
return s_impl.FromAsync(actionAsync);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Converts to asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <param name="actionAsync">Asynchronous action to convert.</param>
|
|
|
|
|
+ /// <param name="scheduler">Scheduler on which to notify observers.</param>
|
|
|
|
|
+ /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
|
|
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="actionAsync"/> is null or <paramref name="scheduler"/> is null.</exception>
|
|
|
|
|
+ public static IObservable<Unit> FromAsync(Func<Task> actionAsync, IScheduler scheduler)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (actionAsync == null)
|
|
|
|
|
+ throw new ArgumentNullException("actionAsync");
|
|
|
|
|
+ if (scheduler == null)
|
|
|
|
|
+ throw new ArgumentNullException("scheduler");
|
|
|
|
|
+
|
|
|
|
|
+ return s_impl.FromAsync(actionAsync, scheduler);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Converts to asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started.
|
|
/// Converts to asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started.
|
|
|
/// The CancellationToken passed to the asynchronous action is tied to the observable sequence's subscription that triggered the action's invocation and can be used for best-effort cancellation.
|
|
/// The CancellationToken passed to the asynchronous action is tied to the observable sequence's subscription that triggered the action's invocation and can be used for best-effort cancellation.
|
|
@@ -1141,9 +1315,31 @@ namespace System.Reactive.Linq
|
|
|
/// <exception cref="ArgumentNullException"><paramref name="actionAsync"/> is null.</exception>
|
|
/// <exception cref="ArgumentNullException"><paramref name="actionAsync"/> is null.</exception>
|
|
|
public static IObservable<Unit> FromAsync(Func<CancellationToken, Task> actionAsync)
|
|
public static IObservable<Unit> FromAsync(Func<CancellationToken, Task> actionAsync)
|
|
|
{
|
|
{
|
|
|
|
|
+ if (actionAsync == null)
|
|
|
|
|
+ throw new ArgumentNullException("actionAsync");
|
|
|
|
|
+
|
|
|
return s_impl.FromAsync(actionAsync);
|
|
return s_impl.FromAsync(actionAsync);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Converts to asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started.
|
|
|
|
|
+ /// The CancellationToken passed to the asynchronous action is tied to the observable sequence's subscription that triggered the action's invocation and can be used for best-effort cancellation.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <param name="actionAsync">Asynchronous action to convert.</param>
|
|
|
|
|
+ /// <param name="scheduler">Scheduler on which to notify observers.</param>
|
|
|
|
|
+ /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
|
|
|
|
|
+ /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.</remarks>
|
|
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="actionAsync"/> is null or <paramref name="scheduler"/> is null.</exception>
|
|
|
|
|
+ public static IObservable<Unit> FromAsync(Func<CancellationToken, Task> actionAsync, IScheduler scheduler)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (actionAsync == null)
|
|
|
|
|
+ throw new ArgumentNullException("actionAsync");
|
|
|
|
|
+ if (scheduler == null)
|
|
|
|
|
+ throw new ArgumentNullException("scheduler");
|
|
|
|
|
+
|
|
|
|
|
+ return s_impl.FromAsync(actionAsync, scheduler);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
#endif
|
|
#endif
|