For developers the quality of a program can be often express in the time used to finish the computation. With current multicore processor we have to move our thinking from a serial execution to a concurrent execution. Using delegates in an asynchronous way can force the CLR to allocate multiple threads to your computation.
In below code sample, you will see that I call one method multiple times. This method simply waits 5 seconds. Calling 6 times this method in a synchronous way makes the time to finish obvious: at least 30 seconds! Now using the BeginInvoke method from my delegate I can add multiple threads to these computations. On my machine the time to achieve this is now 9 seconds only!
Delegate can also be used to call method from different classes. I let you check at the documentation on Msdn.
A very good article to clear my doubts on sync and async method calling from delegate
Thanks Naseet.
through the main thread execution i created a delegate to invoke but at the time of closing i am getting exception objectdispose exception what should i do
Prassana, can you share your code?
good program but explanation is missing???
thanks… good one !!!
very good article.Thanks for sharing .Keep writing .All the Best .
Thank you Priya.
Nice article š
You made my day Awesome !!! Thanks Ahmet
Thank you Karthik!