Megosztás a következőn keresztül:


IAsyncInfo Interface

Definition

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.

public interface class IAsyncInfo
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.FoundationContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(54, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70)]
struct IAsyncInfo
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.FoundationContract), 65536)]
[Windows.Foundation.Metadata.Guid(54, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70)]
public interface IAsyncInfo
Public Interface IAsyncInfo
Derived
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.FoundationContract (introduced in v1.0)

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

Properties

ErrorCode

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

Id

Gets the handle of the asynchronous operation.

Status

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

Methods

Cancel()

Cancels the asynchronous operation.

Close()

Closes the asynchronous operation.

Applies to

See also