System.ComponentModel.AsyncCompletedEventArgs Class

Provides data for the MethodNameCompleted event.

See Also: AsyncCompletedEventArgs Members

Syntax

public class AsyncCompletedEventArgs : EventArgs

Remarks

If you are using a class that implements the Event-based Asynchronous Pattern Overview, the class will provide a MethodNameCompleted event. If you add an instance of the System.ComponentModel.AsyncCompletedEventHandler delegate to the event, you will receive information about the outcome of asynchronous operations in the System.ComponentModel.AsyncCompletedEventArgs parameter of the corresponding event-handler method.

The client application's event-handler delegate can check the AsyncCompletedEventArgs.Cancelled property to determine if the asynchronous task was cancelled.

The client application's event-handler delegate can check the AsyncCompletedEventArgs.Error property to determine if an exception occurred during execution of the asynchronous task.

If the class supports multiple asynchronous methods, or multiple calls to the same asynchronous method, you can determine which task raised the MethodNameCompleted event by checking the value of the AsyncCompletedEventArgs.UserState property. Your code will need to track these tokens, known as task IDs, as their corresponding asynchronous tasks start and complete.

Requirements

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