What is the difference between Invoking and BeginInvoking a MessageBox?
- by mafutrct
In a form, compare
BeginInvoke (new Action (() => {
MessageBox.Show ());
}));
with
Invoke (new Action (() => {
MessageBox.Show ());
}));
What is the difference, and when should I use one over the other? How is the behavior affected by the message pump of the MessageBox?
I did some testing and found that both methods block the UI.
The only difference is that Invoke is actually called instantly while BeginInvoke takes a (very short) time until the code is run. This is to be expected.