Sdílet prostřednictvím


Observable.Toasync<TResult> – metoda (Func<TResult>, IScheduler)

Převede funkci na asynchronní funkci.

Obor názvů:System.Reactive.Linq
Sestavení: System.Reactive (v System.Reactive.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function ToAsync(Of TResult) ( _
    function As Func(Of TResult), _
    scheduler As IScheduler _
) As Func(Of IObservable(Of TResult))
'Usage
Dim function As Func(Of TResult)
Dim scheduler As IScheduler
Dim returnValue As Func(Of IObservable(Of TResult))

returnValue = function.ToAsync(scheduler)
public static Func<IObservable<TResult>> ToAsync<TResult>(
    this Func<TResult> function,
    IScheduler scheduler
)
[ExtensionAttribute]
public:
generic<typename TResult>
static Func<IObservable<TResult>^>^ ToAsync(
    Func<TResult>^ function, 
    IScheduler^ scheduler
)
static member ToAsync : 
        function:Func<'TResult> * 
        scheduler:IScheduler -> Func<IObservable<'TResult>> 
JScript does not support generic types and methods.

Parametry typu

  • Tresult
    Typ výsledku.

Parametry

  • – funkce
    Typ: System.Func<TResult>
    Funkce použitá k synchronizaci.

Návratová hodnota

Typ: System.Func<IObservable<TResult>>
Funkce do asynchronní funkce.

Poznámka k využití

V jazyce Visual Basic a C# můžete tuto metodu volat jako metodu instance u libovolného objektu typu Func<TResult>. Pokud k volání této metody použijete syntaxi metody instance, vynechejte první parametr. Další informace naleznete v tématech a .

Viz také

Reference

Pozorovatelná třída

ToAsync – přetížení

System.Reactive.Linq – obor názvů