Represents an asynchronous action. This is the return type for many Windows Runtime asynchronous methods that don't have a result object, and don't report ongoing progress.
public : interface IAsyncAction : IAsyncInfo
struct winrt::Windows::Foundation::IAsyncAction : IAsyncInfo
public interface IAsyncAction : IAsyncInfo
Public Interface IAsyncAction Implements IAsyncInfo
Windows 10 requirements
Windows 10 (introduced v10.0.10240.0)
Windows.Foundation.FoundationContract (introduced v1)
IAsyncAction is the return type for all Windows Runtime asynchronous methods that don't communicate a result object, or ongoing progress. This constitutes over 300 different Windows Runtime APIs. APIs that do report progress (but don't have a result) use another interface, IAsyncActionWithProgress;.
Instead of using IAsyncAction, some Windows Runtime asynchronous methods use custom action types (which might have "Operation" rather than "Action" in their name). For example, SignOutUserOperation is a Windows Runtime type that implements IAsyncAction. The SignOutUserOperation type is then used as the custom action return type for the SignOutUserAsync method.
The get function exists on the C++/WinRT projection type winrt::Windows::Foundation::IAsyncAction, so you can call the function from within any C++/WinRT project. You will not find the function listed as a member of the IAsyncAction interface, because get is not part of the application binary interface (ABI) surface of the actual Windows Runtime type IAsyncAction. For more info, and code examples showing how to call get, see Write a coroutine.
Notes to implementers
As with calling the existing methods, there are language-specific ways to define asynchronous methods that don't use IAsyncInfo directly. If writing code using .NET, your method can return a Task. For C++/CX, you can use the Concurrency runtime. However, if you're defining a component, you can use Task/task internally but you must return one of the Windows Runtime interfaces for your public methods. The language-specific asynchronous support types (and many other language-specific types you might conventionally use in code) can't be used for the public surface area of a Windows Runtime component.
|Completed Completed Completed Completed Completed||
Gets or sets the method that handles the action completed notification.
|ErrorCode ErrorCode ErrorCode ErrorCode ErrorCode||
Gets a string that describes an error condition of the asynchronous operation.(Inherited from IAsyncInfo)
|Id Id Id Id Id||
Gets the handle of the asynchronous operation.(Inherited from IAsyncInfo)
|Status Status Status Status Status||
Gets a value that indicates the status of the asynchronous operation.(Inherited from IAsyncInfo)
|Cancel Cancel Cancel Cancel Cancel||
Cancels the asynchronous operation.(Inherited from IAsyncInfo)
|Close Close Close Close Close||
Closes the asynchronous operation.(Inherited from IAsyncInfo)
|GetResults() GetResults() GetResults() GetResults() GetResults()||
Returns the results of the action.
We'd love to hear your thoughts. Choose the type you'd like to provide:
Our feedback system is built on GitHub Issues. Read more on our blog.