System.ComponentModel.AsyncOperation.Post Method

Invokes a delegate on the thread or context appropriate for the application model.

Syntax

public void Post (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

The AsyncOperation.Post(System.Threading.SendOrPostCallback, object) method invokes the delegate specified by the arg parameter without ending the lifetime of the asynchronous operation.

You can call the AsyncOperation.Post(System.Threading.SendOrPostCallback, object) method as often as you like while the lifetime of the asynchronous operation has not been ended by a call to AsyncOperation.PostOperationCompleted(System.Threading.SendOrPostCallback, object). You can use the method to report progress or interim results back to clients.

The d parameter wraps the delegate you want called when you want to post an update about the status of the asynchronous task. The System.ComponentModel.AsyncOperation object will ensure that your delegate is invoked on the thread or context appropriate for the application model. Your method can optionally raise an event that notifies clients of a status change, progress update, or newly available incremental results.

The arg parameter should be used to pass state to the delegate wrapped by the d parameter. It might be a reference to an System.ComponentModel.AsyncOperation, or it might be a System.ComponentModel.ProgressChangedEventArgs object. It may be desirable to derive your own class from System.ComponentModel.ProgressChangedEventArgs to provide additional state storage.

Requirements

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