Does Delegate.Invoke() start the method the delegate is pointed at on a new thread, or do you need to use Delegate.BeginInvoke() to do this?
Thanks
Does Delegate.Invoke() start the method the delegate is pointed at on a new thread, or do you need to use Delegate.BeginInvoke() to do this?
Thanks
Delegate.Invoke: Executes synchronously, on the same thread. Delegate.BeginInvoke: Executes asynchronously, on a threadpool thread.
from the answer here - What's the difference between Invoke() and BeginInvoke()
Delegate.Invoke()
is just like calling the delegate, which will cause calling the delegate on the same thread. To make an async call on the delegate, you have to call it with BeginInvoke
which eventually will make the call on a different thread (and then activate the Callback method)