)} ,System.Reactive.Concurrency.IScheduler)} ,System.Reactive.Concurrency.TaskObservationOptions)}
TaskObservableExtensions.ToObservable(Task) method¶
Defined in
Type: TaskObservableExtensions
Namespace: System.Reactive.Threading.Tasks
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static IObservable<Unit> ToObservable(this Task task) - 2.
public static IObservable<Unit> ToObservable(this Task task, IScheduler scheduler) - 3.
public static IObservable<Unit> ToObservable(this Task task, TaskObservationOptions options) - 4.
public static IObservable<TResult> ToObservable<TResult>(this Task<TResult> task) - 5.
public static IObservable<TResult> ToObservable<TResult>(this Task<TResult> task, IScheduler scheduler) - 6.
public static IObservable<TResult> ToObservable<TResult>(this Task<TResult> task, TaskObservationOptions options)
1. Overload¶
public static IObservable<Unit> ToObservable(this Task task)
Summary: Returns an observable sequence that signals when the task completes.
Parameters
| Name | Type | Description |
|---|---|---|
task | Task | Task to convert to an observable sequence. |
Returns: IObservable
Remarks
If the specified task object supports cancellation, consider using FromAsync instead.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | task is null. |
2. Overload¶
public static IObservable<Unit> ToObservable(this Task task, IScheduler scheduler)
Summary: Returns an observable sequence that signals when the task completes.
Parameters
| Name | Type | Description |
|---|---|---|
task | Task | Task to convert to an observable sequence. |
scheduler | [IScheduler](# | Scheduler on which to notify observers about completion, cancellation or failure. |
Returns: IObservable
Remarks
If the specified task object supports cancellation, consider using FromAsync instead.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | task is null or scheduler is null. |
3. Overload¶
public static IObservable<Unit> ToObservable(this Task task, TaskObservationOptions options)
Summary: Returns an observable sequence that signals when the task completes.
Parameters
| Name | Type | Description |
|---|---|---|
task | Task | Task to convert to an observable sequence. |
options | [TaskObservationOptions](# | Controls how the tasks's progress is observed. |
Returns: IObservable
Remarks
If the specified task object supports cancellation, consider using FromAsync instead.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | task is null. |
4. Overload¶
public static IObservable<TResult> ToObservable<TResult>(this Task<TResult> task)
Summary: Returns an observable sequence that propagates the result of the task.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the result produced by the task. |
Parameters
| Name | Type | Description |
|---|---|---|
task | Task | Task to convert to an observable sequence. |
Returns: IObservable
Remarks
If the specified task object supports cancellation, consider using FromAsync instead.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | task is null. |
5. Overload¶
public static IObservable<TResult> ToObservable<TResult>(this Task<TResult> task, IScheduler scheduler)
Summary: Returns an observable sequence that propagates the result of the task.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the result produced by the task. |
Parameters
| Name | Type | Description |
|---|---|---|
task | Task | Task to convert to an observable sequence. |
scheduler | [IScheduler](# | Scheduler on which to notify observers about completion, cancellation or failure. |
Returns: IObservable
Remarks
If the specified task object supports cancellation, consider using FromAsync instead.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | task is null or scheduler is null. |
6. Overload¶
public static IObservable<TResult> ToObservable<TResult>(this Task<TResult> task, TaskObservationOptions options)
Summary: Returns an observable sequence that propagates the result of the task.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the result produced by the task. |
Parameters
| Name | Type | Description |
|---|---|---|
task | Task | Task to convert to an observable sequence. |
options | [TaskObservationOptions](# | Controls how the tasks's progress is observed. |
Returns: IObservable
Remarks
If the specified task object supports cancellation, consider using FromAsync instead.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | task is null. |