JoinableTaskFactory.RunAsync<T> Method (Func<Task<T>>)
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(Of T) ( _
asyncMethod As Func(Of Task(Of T)) _
) As JoinableTask(Of T)
public JoinableTask<T> RunAsync<T>(
Func<Task<T>> asyncMethod
)
public:
generic<typename T>
JoinableTask<T>^ RunAsync(
Func<Task<T>^>^ asyncMethod
)
member RunAsync :
asyncMethod:Func<Task<'T>> -> JoinableTask<'T>
JScript does not support generic types or methods.
Type Parameters
- T
The type of value returned by the asynchronous operation.
Parameters
asyncMethod
Type: System.Func<Task<T>>The asynchronous operation.
Return Value
Type: Microsoft.VisualStudio.Threading.JoinableTask<T>
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
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.