Background Worker Class in C#


As the name suggests the Background Worker Class allows you to set a thread continuously running in the background and communicating with the main thread whenever required.

BackgroundWorker makes the implementation of threads in Windows Forms. Intensive tasks need to be done on another thread so the UI does not freeze. It is necessary to post messages and update the user interface when the task is done. 

The following properties are used in BackgroundWorker class:

Reference: Microsoft Developer Network (MSDN)

S.No.Name & Description
1CancellationPending
A value indicating whether the application has requested cancellation of a background operation.
2CanRaiseEvents
Gets a value indicating whether the component can raise an event
3Container
Gets the IContainer that contains the Component.
4DesignMode
Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.)
5Events
Gets the list of event handlers that are attached to this Component.
6IsBusy
Gets a value indicating whether the BackgroundWorker is running an asynchronous operation.
7Site
Gets or sets the ISite of the Component.
8WorkerReportsProgress
Gets or sets a value indicating whether the BackgroundWorker can report progress updates.
9WorkerSupportsCancellation
Gets or sets a value indicating whether the BackgroundWorker supports asynchronous cancellation.

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 19-Jun-2020

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements