IAsyncInfo interface

Supports asynchronous actions and operations. IAsyncInfo is a base interface for IAsyncAction, IAsyncActionWithProgress<TProgress>, IAsyncOperation<TResult> and IAsyncOperationWithProgress<TResult,TProgress>, each of which support combinations of return type and progress for an asynchronous method.

Syntax


Public Interface IAsyncInfo

Attributes

[Version(0x06020000)]

Members

The IAsyncInfo interface has these types of members:

Methods

The IAsyncInfo interface has these methods. It also inherits methods from the Object class.

MethodDescription
Cancel Cancels the asynchronous operation.
Close Closes the asynchronous operation.

 

Properties

The IAsyncInfo interface has these properties.

PropertyAccess typeDescription

ErrorCode

Read-onlyGets a string that describes an error condition of the asynchronous operation.

Id

Read-onlyGets the handle of the asynchronous operation.

Status

Read-onlyGets a value that indicates the status of the asynchronous operation.

 

Remarks

IAsyncInfo is an inherited interface for each of the 4 Windows Runtime interfaces that are used for asynchronous method support. These are:

When you use asynchronous methods in your app code, you usually don't see any of these interfaces as the return value. That's because you almost always use the language-specific awaitable syntax, which handles the interfaces internally. For more info, see Asynchronous programming, or one of the language-specific guides to Windows Runtime asynchronous programming (C#/Visual Basic, C++, JavaScript).

For most app code, it's uncommon to use IAsyncInfo as an API even if you don't use an awaitable syntax. Each of the languages has extension points that are generally easier to use than is the Windows RuntimeIAsyncInfo interface. JavaScript has the then/done syntax. .NET has the AsTask extension method, and once the IAsyncAction is converted to a Task, it's easier to cancel, get notification on completion, and so on. For C++/CX, you can wrap the calls using the Concurrency runtime. In other words, IAsyncInfo is runtime-level infrastructure, which each of the languages use as a framework to support awaitable syntax in their own way.

If you're implementing a custom action or custom operation (an advanced scenario) don't implement IAsyncAction directly. Implement one of the 4 interfaces previously listed instead.

Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.FoundationContract, introduced version 1.0

Namespace

Windows.Foundation
Windows::Foundation [C++]

Metadata

Windows.Foundation.FoundationContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows.Foundation
Windows::Foundation [C++]

Metadata

Windows.winmd

See also

Asynchronous programming
IAsyncAction
IAsyncOperation<TResult>

 

 

Show:
© 2015 Microsoft