Home  >  Article  >  Backend Development  >  Background worker class in C#

Background worker class in C#

WBOY
WBOYforward
2023-09-03 23:33:021781browse

C# 中的后台工作者类

As the name suggests, the Background Worker class allows you to set up a thread that runs continuously in the background and communicates with the main thread when needed.

BackgroundWorker implements threads in Windows Forms. Intensive tasks need to be done on another thread so that the UI doesn't freeze. After the task is completed it is necessary to publish a message and update the user interface.

The following properties are used in the BackgroundWorker class:

Reference: Microsoft Developer Network (MSDN)

##12345 tr>6789
Serial number Name & Description

CancellationPending Value indicating whether the application requests cancellation of background operations.

td>

CanRaiseEvents strong>Gets a value indicating whether the component can raise events

ContainerGet the IContainer containing the component.

DesignModeGets a value indicating whether the component is currently in design model. (Inherited from Component.)

EventGet the event attached to this component List of event handlers.

IsBusy p>Gets a value indicating whether the BackgroundWorker is running an asynchronous operation.

SiteGets or sets the ISite of the component.

WorkerReportsProgressGets or sets a value indicating whether the BackgroundWorker can report progress renew.

WorkerSupportsCancellationGets or sets a value indicating whether the BackgroundWorker supports asynchronous cancellation.

The above is the detailed content of Background worker class in C#. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete