Share via


TaskObservableExtensions.ToObservable<TResult> Method (Task<TResult>)

Returns an observable sequence that propagates the result of the task.

Namespace:  System.Reactive.Threading.Tasks
Assembly:  System.Reactive (in System.Reactive.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function ToObservable(Of TResult) ( _
    task As Task(Of TResult) _
) As IObservable(Of TResult)
'Usage
Dim task As Task(Of TResult)
Dim returnValue As IObservable(Of TResult)

returnValue = task.ToObservable()
public static IObservable<TResult> ToObservable<TResult>(
    this Task<TResult> task
)
[ExtensionAttribute]
public:
generic<typename TResult>
static IObservable<TResult>^ ToObservable(
    Task<TResult>^ task
)
static member ToObservable : 
        task:Task<'TResult> -> IObservable<'TResult> 
JScript does not support generic types and methods.

Type Parameters

  • TResult
    The type of result.

Parameters

Return Value

Type: System.IObservable<TResult>
An observable sequence that produces the task's result, or propagates the exception produced by the task.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Task<TResult>. When you use instance method syntax to call this method, omit the first parameter. For more information, see or .

See Also

Reference

TaskObservableExtensions Class

ToObservable Overload

System.Reactive.Threading.Tasks Namespace