System.ComponentModel.AsyncOperation.UserSuppliedState Property

Gets or sets an object used to uniquely identify an asynchronous operation.

Syntax

public object UserSuppliedState { get; }

Value

Documentation for this section has not yet been entered.

Remarks

If your class supports multiple asynchronous methods or multiple invocations of a single asynchronous method, clients will need a way to determine which asynchronous task is raising events. Your MethodNameAsync method should take a parameter of type object that will act as a task ID. You will use this task ID when you call the AsyncOperationManager.CreateOperation(object), method and this will associate the client's task ID with a particular invocation of your asynchronous operation. This task ID is made available to your implementation through the AsyncOperation.UserSuppliedState property.

Note:

Client code must be careful to provide a unique value for the AsyncOperation.UserSuppliedState property. Non-unique task IDs may cause your implementation to report progress and other events incorrectly. Your code should check for a non-unique task ID and raise an ArgumentException if one is detected.

Requirements

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