System.ComponentModel.AsyncOperation.PostOperationCompleted Method

Ends the lifetime of an asynchronous operation.

Syntax

public void PostOperationCompleted (System.Threading.SendOrPostCallback d, object arg)

Parameters

d
A System.Threading.SendOrPostCallback object that wraps the delegate to be called when the operation ends.
arg
An argument for the delegate contained in the d parameter.

Remarks

Call the AsyncOperation.PostOperationCompleted(System.Threading.SendOrPostCallback, object) method to end the lifetime of an asynchronous operation. After this method is called for a particular task, calls to its corresponding System.ComponentModel.AsyncOperation object will raise an exception.

The d parameter wraps the delegate you want your class to call when the task's lifetime ends due to completion, cancellation, or failure of the task. The System.ComponentModel.AsyncOperation object will ensure that your delegate is invoked on the thread or context appropriate for the application model. Your delegate can optionally raise an event that notifies clients that the asynchronous task's lifetime has ended.

The arg parameter is used to pass state information to the completion delegate d. You can use an System.ComponentModel.AsyncOperation object, or an System.ComponentModel.AsyncCompletedEventArgs object as the parameter value. Alternatively, if you want to provide additional state storage, you can use an instance of a class you derive from the System.ComponentModel.AsyncCompletedEventArgs class.

Requirements

Namespace: System.ComponentModel
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0