Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WindowsRuntimeSystemExtensions.AsAsyncAction Method

.NET Framework 4.5

Returns a Windows Runtime asynchronous action that represents a started task.

Namespace:  System
Assembly:  System.Runtime.WindowsRuntime (in System.Runtime.WindowsRuntime.dll)

public static IAsyncAction AsAsyncAction(
	this Task source
)

Parameters

source
Type: System.Threading.Tasks.Task

The started task.

Return Value

Type: IAsyncAction
A Windows.Foundation.IAsyncAction instance that represents the started task.

Usage 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).

ExceptionCondition
ArgumentNullException

source is null.

InvalidOperationException

source is an unstarted task.

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.

.NET Framework

Supported in: 4.6, 4.5

Supported in: Windows Phone Silverlight 8
Show:
© 2015 Microsoft