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.

IAsyncOperation<TResult> interface

Represents an asynchronous operation that returns a result.

Template parameters

TResult

The type that encapsulates the result from the asynchronous operation.

Members

The IAsyncOperation<TResult> interface inherits from IAsyncInfo. IAsyncOperation also has these types of members:

Methods

The IAsyncOperation<TResult> interface has these methods.

MethodDescription
get_Completed

Gets the method that is called when the asynchronous operation completes.

GetResults

Gets the outcome of the asynchronous operation.

put_Completed

Sets the method that is called when the asynchronous action completes.

 

Remarks

The IAsyncOperation<TResult> interface represents an asynchronous operation that returns a result and does not have progress notifications. When the operation completes, the IAsyncOperationCompletedHandler<TResult> specified by get_Completed is invoked. The GetResults method receives a pointer to the task results (TResult) of the operation.

Use the Task type provided in the Parallel Patterns Library (ppltasks.h) for asynchronous operations in your own app. For managed code, consider using the await keyword instead of directly using this interface.

IAsyncOperation<T> myAsyncOp = MyObj.SomePublicAsyncMethod();

myAsyncOp.Completed = (op) => {
  // ...
  T myResults = op.GetResults();
  // ...
};

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Header

Windows.Foundation.Collections.h

See also

IAsyncOperationCompletedHandler<TResult>

 

 

Community Additions

Show:
© 2014 Microsoft. All rights reserved.