IAsyncInfo IAsyncInfo IAsyncInfo IAsyncInfo IAsyncInfo Interface

Definition

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

public : interface IAsyncInfo
struct winrt::Windows::Foundation::IAsyncInfo
public interface IAsyncInfo
Public Interface IAsyncInfo
// You can't instantiate an interface directly in JavaScript. You can use objects that implement the interface, however.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.FoundationContract (introduced v1)

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 (Call asynchronous APIs in C# or 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 Runtime@Windows.Foundation.IAsyncInfo?text=IAsyncInfo 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.

Properties

ErrorCode ErrorCode ErrorCode ErrorCode ErrorCode

Gets a string that describes an error condition of the asynchronous operation.

Id Id Id Id Id

Gets the handle of the asynchronous operation.

Status Status Status Status Status

Gets a value that indicates the status of the asynchronous operation.

Methods

Cancel() Cancel() Cancel() Cancel() Cancel()

Cancels the asynchronous operation.

Close() Close() Close() Close() Close()

Closes the asynchronous operation.

See Also