Just wondering what the difference between BeginInvoke()
and Invoke()
are?
Mainly what each one would be used for.
EDIT: What is t
The difference between Control.Invoke()
and Control.BeginInvoke()
is,
BeginInvoke()
will schedule the asynchronous action on the GUI thread. When the asynchronous action is scheduled, your code continues. Some time later (you don't know exactly when) your asynchronous action will be executedInvoke()
will execute your asynchronous action (on the GUI thread) and wait until your action has completed.A logical conclusion is that a delegate you pass to Invoke()
can have out-parameters or a return-value, while a delegate you pass to BeginInvoke()
cannot (you have to use EndInvoke to retrieve the results).