Call a method asynchronously using Delegate EndInvoke Pattern in 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

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.




Download (RAR, 581B)


Hassan Askari