})} },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.FromAsync(Func>) method¶
Defined in
Type: Observable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static IObservable<TResult> FromAsync<TResult>(Func<Task<TResult>> functionAsync) - 2.
public static IObservable<TResult> FromAsync<TResult>(Func<Task<TResult>> functionAsync, IScheduler scheduler) - 3.
public static IObservable<TResult> FromAsync<TResult>(Func<Task<TResult>> functionAsync, TaskObservationOptions options) - 4.
public static IObservable<TResult> FromAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync) - 5.
public static IObservable<TResult> FromAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync, IScheduler scheduler) - 6.
public static IObservable<TResult> FromAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync, TaskObservationOptions options) - 7.
public static IObservable<Unit> FromAsync(Func<Task> actionAsync) - 8.
public static IObservable<Unit> FromAsync(Func<Task> actionAsync, IScheduler scheduler) - 9.
public static IObservable<Unit> FromAsync(Func<Task> actionAsync, TaskObservationOptions options) - 10.
public static IObservable<Unit> FromAsync(Func<CancellationToken, Task> actionAsync) - 11.
public static IObservable<Unit> FromAsync(Func<CancellationToken, Task> actionAsync, IScheduler scheduler) - 12.
public static IObservable<Unit> FromAsync(Func<CancellationToken, Task> actionAsync, TaskObservationOptions options)
1. Overload¶
public static IObservable<TResult> FromAsync<TResult>(Func<Task<TResult>> functionAsync)
Summary: Converts an asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the result returned by the asynchronous function. |
Parameters
| Name | Type | Description |
|---|---|---|
functionAsync | Func | Asynchronous function to convert. |
Returns: IObservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | functionAsync is null. |
2. Overload¶
public static IObservable<TResult> FromAsync<TResult>(Func<Task<TResult>> functionAsync, IScheduler scheduler)
Summary: Converts an asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the result returned by the asynchronous function. |
Parameters
| Name | Type | Description |
|---|---|---|
functionAsync | Func | Asynchronous function to convert. |
scheduler | [IScheduler](# | Scheduler on which to notify observers. |
Returns: IObservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | functionAsync is null or scheduler is null. |
3. Overload¶
public static IObservable<TResult> FromAsync<TResult>(Func<Task<TResult>> functionAsync, TaskObservationOptions options)
Summary: Converts an asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the result returned by the asynchronous function. |
Parameters
| Name | Type | Description |
|---|---|---|
functionAsync | Func | Asynchronous function to convert. |
options | [TaskObservationOptions](# | Controls how the tasks's progress is observed. |
Returns: IObservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | functionAsync is null. |
4. Overload¶
public static IObservable<TResult> FromAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync)
Summary: Converts an 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.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the result returned by the asynchronous function. |
Parameters
| Name | Type | Description |
|---|---|---|
functionAsync | Func | Asynchronous function to convert. |
Returns: IObservable
Remarks
When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | functionAsync is null. |
5. Overload¶
public static IObservable<TResult> FromAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync, IScheduler scheduler)
Summary: Converts an 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.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the result returned by the asynchronous function. |
Parameters
| Name | Type | Description |
|---|---|---|
functionAsync | Func | Asynchronous function to convert. |
scheduler | [IScheduler](# | Scheduler on which to notify observers. |
Returns: IObservable
Remarks
When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | functionAsync is null or scheduler is null. |
6. Overload¶
public static IObservable<TResult> FromAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync, TaskObservationOptions options)
Summary: Converts an 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.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the result returned by the asynchronous function. |
Parameters
| Name | Type | Description |
|---|---|---|
functionAsync | Func | Asynchronous function to convert. |
options | [TaskObservationOptions](# | Controls how the tasks's progress is observed. |
Returns: IObservable
Remarks
When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | functionAsync is null. |
7. Overload¶
public static IObservable<Unit> FromAsync(Func<Task> actionAsync)
Summary: Converts an asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started.
Parameters
| Name | Type | Description |
|---|---|---|
actionAsync | Func | Asynchronous action to convert. |
Returns: IObservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | actionAsync is null. |
8. Overload¶
public static IObservable<Unit> FromAsync(Func<Task> actionAsync, IScheduler scheduler)
Summary: Converts an asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started.
Parameters
| Name | Type | Description |
|---|---|---|
actionAsync | Func | Asynchronous action to convert. |
scheduler | [IScheduler](# | Scheduler on which to notify observers. |
Returns: IObservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | actionAsync is null or scheduler is null. |
9. Overload¶
public static IObservable<Unit> FromAsync(Func<Task> actionAsync, TaskObservationOptions options)
Summary: Converts an asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started.
Parameters
| Name | Type | Description |
|---|---|---|
actionAsync | Func | Asynchronous action to convert. |
options | [TaskObservationOptions](# | Controls how the tasks's progress is observed. |
Returns: IObservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | actionAsync is null. |
10. Overload¶
public static IObservable<Unit> FromAsync(Func<CancellationToken, Task> actionAsync)
Summary: Converts an 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.
Parameters
| Name | Type | Description |
|---|---|---|
actionAsync | Func | Asynchronous action to convert. |
Returns: IObservable
Remarks
When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | actionAsync is null. |
11. Overload¶
public static IObservable<Unit> FromAsync(Func<CancellationToken, Task> actionAsync, IScheduler scheduler)
Summary: Converts an 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.
Parameters
| Name | Type | Description |
|---|---|---|
actionAsync | Func | Asynchronous action to convert. |
scheduler | [IScheduler](# | Scheduler on which to notify observers. |
Returns: IObservable
Remarks
When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | actionAsync is null or scheduler is null. |
12. Overload¶
public static IObservable<Unit> FromAsync(Func<CancellationToken, Task> actionAsync, TaskObservationOptions options)
Summary: Converts an 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.
Parameters
| Name | Type | Description |
|---|---|---|
actionAsync | Func | Asynchronous action to convert. |
options | [TaskObservationOptions](# | Controls how the tasks's progress is observed. |
Returns: IObservable
Remarks
When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | actionAsync is null. |