共用方式為


VsTaskLibraryHelper.InvokeAsync<T> Method

Definition

Helper function that transforms a TPL task from an async function into an IVsTask.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static Microsoft::VisualStudio::Shell::Interop::IVsTask ^ InvokeAsync(Microsoft::VisualStudio::Shell::Interop::IVsTaskSchedulerService ^ scheduler, Microsoft::VisualStudio::Shell::VsInvokableAsyncFunction<T> ^ asyncFunction);
public static Microsoft.VisualStudio.Shell.Interop.IVsTask InvokeAsync<T> (this Microsoft.VisualStudio.Shell.Interop.IVsTaskSchedulerService scheduler, Microsoft.VisualStudio.Shell.VsInvokableAsyncFunction<T> asyncFunction);
static member InvokeAsync : Microsoft.VisualStudio.Shell.Interop.IVsTaskSchedulerService * Microsoft.VisualStudio.Shell.VsInvokableAsyncFunction<'T> -> Microsoft.VisualStudio.Shell.Interop.IVsTask
<Extension()>
Public Function InvokeAsync(Of T) (scheduler As IVsTaskSchedulerService, asyncFunction As VsInvokableAsyncFunction(Of T)) As IVsTask

Type Parameters

T

The return type of the task.

Parameters

scheduler
IVsTaskSchedulerService

IVsTaskScheduler used to create the IVsTaskCompletionSource.

asyncFunction
VsInvokableAsyncFunction<T>

Asynchronous function that takes an IVsTaskCompletionSource and returns a TPL task.

Returns

Returns an IVsTask that only completes once the TPL task returned from asyncFunction completes.

Applies to