IAsyncOperation<TResult>.Completed IAsyncOperation<TResult>.Completed IAsyncOperation<TResult>.Completed IAsyncOperation<TResult>.Completed IAsyncOperation<TResult>.Completed Property

Definition

Gets or sets the method that handles the operation completed notification.

public : AsyncOperationCompletedHandler<TResult> Completed { get; set; }
AsyncOperationCompletedHandler<TResult> Completed();

void Completed(AsyncOperationCompletedHandler<TResult> completed);
public AsyncOperationCompletedHandler<TResult> Completed { get; set; }
Public ReadWrite Property Completed As AsyncOperationCompletedHandler<TResult>
var asyncOperationCompletedHandler = iAsyncOperation`1.completed;
iAsyncOperation`1.completed = asyncOperationCompletedHandler;

Property Value

Examples

For example C++/WinRT code illustrating how to handle the Completed event, see Delegate types for asynchronous actions and operations.

Remarks

The Windows Runtime enforces that this property can only be set once on an operation.

Generally, a completed IAsyncOperation; method called using awaitable syntax does nothing further than to return its result (an object of the TResult type) when it completes.

If you're implementing IAsyncOperation;, then the set implementation of Completed should store the handler, and the surrounding logic should invoke it when Close is called. The implementation should set the asyncStatus parameter of invoked callbacks appropriately if there is a Cancel call, Status is not Completed, errors occurred, and so on.

See also