Technology

Call a method asynchronously using Delegate EndInvoke Pattern in Asp.net Part I

We can call a method asynchronously using delegate. Delegate is an object that can wrapped function asynchronously. Delegate is just like the function pointer in c++.

For more information about delegates you can check this Link http://msdn.microsoft.com/en-us/library/ms173171.aspx.

You can invoke any method asynchronously with a little effort using BeginInvoke and EndInvoke methods of the delegate class.

BeginInvoke: Start or initiate asynchronous call as a separate thread.

IAsynResult: Can be used to monitor the progress of the asynchronously call.

EndInvoke: Retrieve the result of asynchronous call and release all thread resources.

We have many techniques to handle delegates like EndInvoke, Callback, WaitHandle, polling etc. but in this article we will focus to the first pattern EndInvoke.

EndInvoke

Result:

EndInvokeResult

Download (RAR, 581B)

Author

Hassan Askari