Friday, 7 October 2011

Control.BeginInvoke() vs Control.Invoke()

The BeginInvoke() method has a IAsyncResult type return value and the Invoke() method simply return a object. This makes a big difference between them which is the BeginInvoke() is making a asynchronous callback to the thread created the handle of the control.

Assuming the main thread is A and currently executing code is in thread B, if call Invoke() from thread B then thread B has to wait for the callback to thread A being finished and then continue the following process.

No comments: