C# Language Creating a new BackgroundWorker instance


Example

A BackgroundWorker is commonly used to perform tasks, sometimes time consuming, without blocking the UI thread.

// BackgroundWorker is part of the ComponentModel namespace.
using System.ComponentModel;

namespace BGWorkerExample 
{
     public partial class ExampleForm : Form 
     {

      // the following creates an instance of the BackgroundWorker named "bgWorker"
      BackgroundWorker bgWorker = new BackgroundWorker();

      public ExampleForm() { ...