[转载]:Invoke and BeginInvoke





To begin, from your link:

  • Control.Invoke: Executes on the UI thread, but calling thread waits for completion before continuing.
  • Control.BeginInvoke: Executes on the asynchronous UI thread, and calling thread doesn't wait for completion.

and from MSDN:

BeginInvoke executes the specified delegate asynchronously on the thread that the control's underlying handle was created on.

To sum it up, BeginInvoke is asynchronous. When BeginInvoke is called from the UI thread the request will be executed in parallel with the UI thread. Which means it may not execute until after the currently executing method has returned. So in this case the text box will never appear to update because the for loop will not be interrupted, as the calling thread will not wait for this event to be completed before continuing.

Alternatively, Invoke is synchronous. The text box will be updated because the calling thread will wait for the call to complete before continuing execution.

http://stackoverflow.com/questions/1909839/invoke-and-begininvoke
做个快乐的自己。
原文地址:https://www.cnblogs.com/Jessy/p/2170010.html