})} },System.Reactive.Concurrency.IScheduler)} },System.Reactive.Concurrency.TaskObservationOptions)} })} },System.Reactive.Concurrency.IScheduler)} },System.Reactive.Concurrency.TaskObservationOptions)} )} ,System.Reactive.Concurrency.IScheduler)} ,System.Reactive.Concurrency.TaskObservationOptions)} )} ,System.Reactive.Concurrency.IScheduler)} ,System.Reactive.Concurrency.TaskObservationOptions)}
Observable.StartAsync(Func>) method¶
Defined in
Type: Observable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static IObservable<TResult> StartAsync<TResult>(Func<Task<TResult>> functionAsync) - 2.
public static IObservable<TResult> StartAsync<TResult>(Func<Task<TResult>> functionAsync, IScheduler scheduler) - 3.
public static IObservable<TResult> StartAsync<TResult>(Func<Task<TResult>> functionAsync, TaskObservationOptions options) - 4.
public static IObservable<TResult> StartAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync) - 5.
public static IObservable<TResult> StartAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync, IScheduler scheduler) - 6.
public static IObservable<TResult> StartAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync, TaskObservationOptions options) - 7.
public static IObservable<Unit> StartAsync(Func<Task> actionAsync) - 8.
public static IObservable<Unit> StartAsync(Func<Task> actionAsync, IScheduler scheduler) - 9.
public static IObservable<Unit> StartAsync(Func<Task> actionAsync, TaskObservationOptions options) - 10.
public static IObservable<Unit> StartAsync(Func<CancellationToken, Task> actionAsync) - 11.
public static IObservable<Unit> StartAsync(Func<CancellationToken, Task> actionAsync, IScheduler scheduler) - 12.
public static IObservable<Unit> StartAsync(Func<CancellationToken, Task> actionAsync, TaskObservationOptions options)
1. Overload¶
public static IObservable<TResult> StartAsync<TResult>(Func<Task<TResult>> functionAsync)
Summary: Invokes the asynchronous function, surfacing the result through an observable sequence.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the result returned by the asynchronous function. |
Parameters
| Name | Type | Description |
|---|---|---|
functionAsync | Func | Asynchronous function to run. |
Returns: IObservable
Remarks
- The function is started immediately, not during the subscription of the resulting sequence.
- Multiple subscriptions to the resulting sequence can observe the function's result.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | functionAsync is null. |
2. Overload¶
public static IObservable<TResult> StartAsync<TResult>(Func<Task<TResult>> functionAsync, IScheduler scheduler)
Summary: Invokes the asynchronous function, surfacing the result through an observable sequence.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the result returned by the asynchronous function. |
Parameters
| Name | Type | Description |
|---|---|---|
functionAsync | Func | Asynchronous function to run. |
scheduler | [IScheduler](# | Scheduler on which to notify observers. |
Returns: IObservable
Remarks
- The function is started immediately, not during the subscription of the resulting sequence.
- Multiple subscriptions to the resulting sequence can observe the function's result.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | functionAsync is null or scheduler is null. |
3. Overload¶
public static IObservable<TResult> StartAsync<TResult>(Func<Task<TResult>> functionAsync, TaskObservationOptions options)
Summary: Invokes the asynchronous function, surfacing the result through an observable sequence.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the result returned by the asynchronous function. |
Parameters
| Name | Type | Description |
|---|---|---|
functionAsync | Func | Asynchronous function to run. |
options | [TaskObservationOptions](# | Controls how the tasks's progress is observed. |
Returns: IObservable
Remarks
- The function is started immediately, not during the subscription of the resulting sequence.
- Multiple subscriptions to the resulting sequence can observe the function's result.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | functionAsync is null. |
4. Overload¶
public static IObservable<TResult> StartAsync<TResult>(Func<CancellationToken, Task<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.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the result returned by the asynchronous function. |
Parameters
| Name | Type | Description |
|---|---|---|
functionAsync | Func | Asynchronous function to run. |
Returns: IObservable
Remarks
- The function is started immediately, not during the subscription of the resulting sequence.
- Multiple subscriptions to the resulting sequence can observe the function's result.
-
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.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | functionAsync is null. |
5. Overload¶
public static IObservable<TResult> StartAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync, IScheduler scheduler)
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.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the result returned by the asynchronous function. |
Parameters
| Name | Type | Description |
|---|---|---|
functionAsync | Func | Asynchronous function to run. |
scheduler | [IScheduler](# | Scheduler on which to notify observers. |
Returns: IObservable
Remarks
- The function is started immediately, not during the subscription of the resulting sequence.
- Multiple subscriptions to the resulting sequence can observe the function's result.
-
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.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | functionAsync is null or scheduler is null. |
6. Overload¶
public static IObservable<TResult> StartAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync, TaskObservationOptions options)
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.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the result returned by the asynchronous function. |
Parameters
| Name | Type | Description |
|---|---|---|
functionAsync | Func | Asynchronous function to run. |
options | [TaskObservationOptions](# | Controls how the tasks's progress is observed. |
Returns: IObservable
Remarks
- The function is started immediately, not during the subscription of the resulting sequence.
- Multiple subscriptions to the resulting sequence can observe the function's result.
-
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.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | functionAsync is null. |
7. Overload¶
public static IObservable<Unit> StartAsync(Func<Task> actionAsync)
Summary: Invokes the asynchronous action, surfacing the result through an observable sequence.
Parameters
| Name | Type | Description |
|---|---|---|
actionAsync | Func | Asynchronous action to run. |
Returns: IObservable
Remarks
- The action is started immediately, not during the subscription of the resulting sequence.
- Multiple subscriptions to the resulting sequence can observe the action's outcome.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | actionAsync is null. |
8. Overload¶
public static IObservable<Unit> StartAsync(Func<Task> actionAsync, IScheduler scheduler)
Summary: Invokes the asynchronous action, surfacing the result through an observable sequence.
Parameters
| Name | Type | Description |
|---|---|---|
actionAsync | Func | Asynchronous action to run. |
scheduler | [IScheduler](# | Scheduler on which to notify observers. |
Returns: IObservable
Remarks
- The action is started immediately, not during the subscription of the resulting sequence.
- Multiple subscriptions to the resulting sequence can observe the action's outcome.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | actionAsync is null or scheduler is null. |
9. Overload¶
public static IObservable<Unit> StartAsync(Func<Task> actionAsync, TaskObservationOptions options)
Summary: Invokes the asynchronous action, surfacing the result through an observable sequence.
Parameters
| Name | Type | Description |
|---|---|---|
actionAsync | Func | Asynchronous action to run. |
options | [TaskObservationOptions](# | Controls how the tasks's progress is observed. |
Returns: IObservable
Remarks
- The action is started immediately, not during the subscription of the resulting sequence.
- Multiple subscriptions to the resulting sequence can observe the action's outcome.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | actionAsync is null. |
10. Overload¶
public static IObservable<Unit> StartAsync(Func<CancellationToken, Task> 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.
Parameters
| Name | Type | Description |
|---|---|---|
actionAsync | Func | Asynchronous action to run. |
Returns: IObservable
Remarks
- The action is started immediately, not during the subscription of the resulting sequence.
- Multiple subscriptions to the resulting sequence can observe the action's outcome.
-
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.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | actionAsync is null. |
11. Overload¶
public static IObservable<Unit> StartAsync(Func<CancellationToken, Task> actionAsync, IScheduler scheduler)
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.
Parameters
| Name | Type | Description |
|---|---|---|
actionAsync | Func | Asynchronous action to run. |
scheduler | [IScheduler](# | Scheduler on which to notify observers. |
Returns: IObservable
Remarks
- The action is started immediately, not during the subscription of the resulting sequence.
- Multiple subscriptions to the resulting sequence can observe the action's outcome.
-
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.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | actionAsync is null or scheduler is null. |
12. Overload¶
public static IObservable<Unit> StartAsync(Func<CancellationToken, Task> actionAsync, TaskObservationOptions options)
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.
Parameters
| Name | Type | Description |
|---|---|---|
actionAsync | Func | Asynchronous action to run. |
options | [TaskObservationOptions](# | Controls how the tasks's progress is observed. |
Returns: IObservable
Remarks
- The action is started immediately, not during the subscription of the resulting sequence.
- Multiple subscriptions to the resulting sequence can observe the action's outcome.
-
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.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | actionAsync is null. |