The BackgroundWorker

So far, you've seen the no-frills approach to multithreading—creating a new System.Threading.Thread object by hand, supplying your asynchronous code, and launching it with the Thread.Start() method. This approach is powerful, because the Thread object doesn't hold anything back. You can create dozens of threads at will, pass information to them at any time, temporarily delay them with Thread.Sleep(), and so on. However, this approach is also a bit dangerous. If you access shared data, you need to use locking to prevent subtle errors. If you create threads frequently or in large numbers, you'll generate additional, unnecessary overhead.

One of the simplest and safest approaches to multithreading is provided by the System.ComponentModel.BackgroundWorker ...

Get Pro Silverlight 5 in VB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.