Worker thread vs BeginInvoke?

J

Jon Pope

What is the difference between firing off a method via BeginInvoke, and
running code on a worker thread? Based on the documentation, it would
appear that the asynchronous call created with BeginInvoke does the same
thing as a worker thread, but the async call runs in the UI thread.

Cheers, Jon
 
J

Jon Skeet [C# MVP]

Jon Pope said:
What is the difference between firing off a method via BeginInvoke, and
running code on a worker thread? Based on the documentation, it would
appear that the asynchronous call created with BeginInvoke does the same
thing as a worker thread, but the async call runs in the UI thread.

Which BeginInvoke do you mean? If you mean a delegate call, the work is
done on a thread pool thread. If you mean Control.BeginInvoke, the work
is done on the UI thread, which is important for UI work where you
*must* use the UI thread if you touch any controls.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top