AsyncDelegate Property
Collapse the table of content
Expand the table of content

AsyncResult.AsyncDelegate Property

 

Gets the delegate object on which the asynchronous call was invoked.

Namespace:   System.Runtime.Remoting.Messaging
Assembly:  mscorlib (in mscorlib.dll)

abstract AsyncDelegate : Object with get
override AsyncDelegate : Object with get

Property Value

Type: System.Object

The delegate object on which the asynchronous call was invoked.

The AsyncDelegate property can be cast to the actual class of the user-defined delegate.

For example, if the delegate that was used to make the asynchronous call is of type MyDelegate, the delegate that is returned by this property must be cast to MyDelegate. The callback method can then call the delegate's EndInvoke method with the correct signature, in order to obtain the results of the asynchronous method call.

The following code example demonstrates how to use the AsyncDelegate property to get the delegate that was used to make the asynchronous call, in order to call EndInvoke. The example casts the IAsyncResult, which is the only parameter of the callback method, to an AsyncResult object.

The example consists of two classes, the class that contains the method which is called asynchronously, and the class that contains the Main method that makes the call.

For more information on the way this callback example works, and more examples of calling methods asynchronously by using delegates, see Calling Synchronous Methods Asynchronously.

No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft