JoinableTaskFactory.RunAsync Method (Func<Task>)
Wraps the invocation of an asynchronous method so that it may execute asynchronously, but may potentially be synchronously completed (waited on) in the future.
Namespace: Microsoft.VisualStudio.Threading
Assembly: Microsoft.VisualStudio.Threading (in Microsoft.VisualStudio.Threading.dll)
Syntax
'Declaration
Public Function RunAsync ( _
asyncMethod As Func(Of Task) _
) As JoinableTask
public JoinableTask RunAsync(
Func<Task> asyncMethod
)
public:
JoinableTask^ RunAsync(
Func<Task^>^ asyncMethod
)
member RunAsync :
asyncMethod:Func<Task> -> JoinableTask
public function RunAsync(
asyncMethod : Func<Task>
) : JoinableTask
Parameters
asyncMethod
Type: System.Func<Task>The asynchronous method.
Return Value
Type: Microsoft.VisualStudio.Threading.JoinableTask
An object that tracks the completion of the asynchronous operation, and allows for later synchronous blocking of the main thread for completion if necessary.
Remarks
Any exceptions thrown by the delegate are captured by the returned JoinableTask.
.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.