I'm unclear as to the differences between multithreading and application and using a background worker. Could someone please explain when one should be used over the other and what their differences are?
Printable View
I'm unclear as to the differences between multithreading and application and using a background worker. Could someone please explain when one should be used over the other and what their differences are?
The BackgroundWorker is just a class that wraps a thread to hide some of the detail and make it easier to use by providing specific methods and events. You should use the BackgroundWorker if it can do what you want. If you need more fine-grained control then create a Thread yourself.
Okay, that makes sense. Thanks JMC. :thumb:
If youre referring to a means to make your form more responsive, then you can also look at asynchronous delegates, which is actually kind of what background workers are, I believe (although not positive). A good article to read:
"Give Your .NET-based Application a Fast and Responsive UI with Multiple Threads"
http://msdn.microsoft.com/msdnmag/is...g/default.aspx
The code is C#, but the article explains it pretty well...
Further to what Gig said, the Advanced .NET link in the Articles section of my signature has topics on Asynchronous Programming and Managed Threading, which are both worthy reading.