Asynchronous Method Signatures
The method signature is the ordering of the parameter types in a method. The rules for the BeginInvoke asynchronous method signature are:
- Include all IN parameters.
- Include all OUT parameters.
- Include all IN/OUT parameters.
- Include all ByRef parameters.
- Take AsyncCallback and AsyncState (available through the AsyncState property on the IAsyncResult interface) as the last two parameters.
- Return IAsyncResult.
The rules for the EndInvoke asynchronous method signature are:
- Include all IN/OUT parameters.
- Include all OUT parameters.
- Include all ByRef parameters.
- Take IAsyncResult as last parameter.
- Return the original return type from the original method signature.
The result object (IAsyncResult) is returned from the begin operation, and can be used to obtain status on whether the asynchronous begin operation has completed. The result object is passed to the end operation, which returns the final return value of the call. An optional callback can be supplied in the begin operation. If the callback is supplied, when the call completes, the callback will be called; and code in the callback can call the end operation.
See Also
Asynchronous Design Pattern Overview | IAsyncResult Interface | AsyncCallback Delegate for Asynchronous Operations | Asynchronous Programming