WindowsRuntimeSystemExtensions.AsAsyncAction(Task) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a Windows Runtime asynchronous action that represents a started task.
public:
[System::Runtime::CompilerServices::Extension]
static Windows::Foundation::IAsyncAction ^ AsAsyncAction(System::Threading::Tasks::Task ^ source);
public static Windows.Foundation.IAsyncAction AsAsyncAction (this System.Threading.Tasks.Task source);
static member AsAsyncAction : System.Threading.Tasks.Task -> Windows.Foundation.IAsyncAction
<Extension()>
Public Function AsAsyncAction (source As Task) As IAsyncAction
Parameters
- source
- Task
The started task.
Returns
A IAsyncAction instance that represents the started task.
Exceptions
source
is null
.
source
is an unstarted task.
Remarks
Note
In Visual Basic and C#, you can call this method as an instance method on any object of type Task. 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 to a Windows Runtime method that takes an asynchronous action.
The AsyncInfo class provides static methods (Shared
methods in Visual Basic) that create and start Windows Runtime asynchronous actions that represent tasks that can respond to cancellation requests and report progress.