WindowsRuntimeSystemExtensions.AsAsyncOperation(Of TResult) Method
Returns a Windows Runtime asynchronous operation that represents a started task that returns a result.
Assembly: System.Runtime.WindowsRuntime (in System.Runtime.WindowsRuntime.dll)
'Declaration <ExtensionAttribute> _ Public Shared Function AsAsyncOperation(Of TResult) ( _ source As Task(Of TResult) _ ) As IAsyncOperation(Of TResult)
The type that returns the result.
- Type: System.Threading.Tasks.Task(Of )
The started task.
Return ValueType: IAsyncOperation(Of )
A Windows.Foundation.IAsyncOperation<TResult> instance that represents the started task.
Usage NoteIn Visual Basic and C#, you can call this method as an instance method on any object of type Task(Of ). 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).
Use this method when you want to pass a task that returns a result to a Windows Runtime method that takes an asynchronous operation.
The AsyncInfo class provides static methods (Shared methods in Visual Basic) that create and start Windows Runtime asynchronous operations that represent tasks that return results and can respond to cancellation requests and report progress.