VsTaskLibraryHelper.InvokeAsync<T> Method
transforms a task parallel library (TPL) task from an asynchronous function into an IVsTask.
Namespace: Microsoft.VisualStudio.Shell
Assembly: Microsoft.VisualStudio.Shell.11.0 (in Microsoft.VisualStudio.Shell.11.0.dll)
Syntax
'Declaración
<ExtensionAttribute> _
Public Shared Function InvokeAsync(Of T) ( _
scheduler As IVsTaskSchedulerService, _
asyncFunction As VsInvokableAsyncFunction(Of T) _
) As IVsTask
public static IVsTask InvokeAsync<T>(
this IVsTaskSchedulerService scheduler,
VsInvokableAsyncFunction<T> asyncFunction
)
Type Parameters
- T
Return type of the task.
Parameters
- scheduler
Type: Microsoft.VisualStudio.Shell.Interop.IVsTaskSchedulerService
Task scheduler used to create the IVsTaskCompletionSource.
- asyncFunction
Type: Microsoft.VisualStudio.Shell.VsInvokableAsyncFunction<T>
Asynchronous function that takes an IVsTaskCompletionSource and returns a TPL task.
Return Value
Type: Microsoft.VisualStudio.Shell.Interop.IVsTask
An IVsTask that only completes once the TPL task that was returned from asyncFunction completes.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IVsTaskSchedulerService. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.