What is the difference between Invoking and BeginInvoking a MessageBox?
        Posted  
        
            by mafutrct
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by mafutrct
        
        
        
        Published on 2010-05-12T13:22:48Z
        Indexed on 
            2010/05/12
            13:44 UTC
        
        
        Read the original article
        Hit count: 239
        
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.
© Stack Overflow or respective owner