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
1 CancellationPending
A value indicating whether the application has requested cancellation of a background operation.
2 CanRaiseEvents
Gets a value indicating whether the component can raise an event
3 Container
Gets the IContainer that contains the Component.
4 DesignMode
Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.)
5 Events
Gets the list of event handlers that are attached to this Component.
6 IsBusy
Gets a value indicating whether the BackgroundWorker is running an asynchronous operation.
7 Site
Gets or sets the ISite of the Component.
8 WorkerReportsProgress
Gets or sets a value indicating whether the BackgroundWorker can report progress updates.
9 WorkerSupportsCancellation
Gets or sets a value indicating whether the BackgroundWorker supports asynchronous cancellation.
Updated on: 2020-06-19T08:24:59+05:30

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements