Difference BackgroundWorker / Threads

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anybody tell me, whats the main difference between a BackgroundWorker and
a Thread? What are the advantages/disadvanteges? When use a BackgroundWorker,
when a Thread?
 
DHarry said:
Can anybody tell me, whats the main difference between a BackgroundWorker and
a Thread? What are the advantages/disadvanteges? When use a BackgroundWorker,
when a Thread?

BackgroundWorker operates in a different thread already. It just
provides a convenient way of reporting progress with all the
marshalling back to the UI thread being done for you.
 
The nice thing about a BackgroundWorker component is that it handles all the
marshalling for you, with a consistent and fairly simple object model. In a
Windows Forms app, this can be a real time-saver for the developer.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.
 
I see... is it right that a BackgroundWorker is a special kind of Thread with
additional methods?
 
Not exactly. A BackgroundWorker is a component, which encapsulates the
functionality to marshall between an asynchronous Thread and the Windows
Form STA Thread.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.
 
Back
Top