Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8554167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:49:09+00:00 2026-06-11T14:49:09+00:00

Thread1.WorkerReportsProgress = true; Thread1.ProgressChanged += new ProgressChangedEventHandler(Function2HandleWhenProgressChanges); //When progress changes, define a function to

  • 0
Thread1.WorkerReportsProgress = true;  
Thread1.ProgressChanged += new ProgressChangedEventHandler(Function2HandleWhenProgressChanges); //When progress changes, define a function to handle  it.
Thread1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Function2HandleWhenThreadIsFinished); //The function to run when the thread is finished
Thread1.DoWork += new DoWorkEventHandler(Thread1_DoWorkDo); //The function defining what the thread must do.

Now, I understand that ProgressChangedEventHandler is a delegate. A delegate, in turn, turns out to be a class.

1. “ProgressChangedEventHandler” belongs to which class ? I have not defined any in my code.

2. Is “ProgressChanged” an event ? If so, which class does this belong to ?

3. If I don’t specify “new ProgressChangedEventHandler” still the code compiles ?. Something like below.

 Thread1.WorkerReportsProgress = true;  
 Thread1.ProgressChanged += Function2HandleWhenProgressChanges; //When progress changes,  define a function to handle  it.
 Thread1.RunWorkerCompleted += Function2HandleWhenThreadIsFinished; //The function to run when the thread is finished
 Thread1.DoWork += Thread1_DoWorkDo; //The function defining what the thread must do.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:49:10+00:00Added an answer on June 11, 2026 at 2:49 pm

    A delegate, in turn, turns out to be a class.

    It is not a class, it is a type. Which explains why you ask these other questions. Think of it as a type description of a method, the return type and arguments are important. A delegate type helps the compiler to make sure you assign the right kind of event handler method. The method must have the exact same return type and arguments as the delegate type. The compiler complains if that’s not the case. This kind of type safety is very important in .NET.

    “ProgressChangedEventHandler” belongs to which class?

    It is a delegate type, not a class. It is declared in the .NET framework. Adding a reference to System.dll and putting using System.ComponentModel at the top of your program allows you to use it without spelling out the full type name.

    Is “ProgressChanged” an event ?

    Yes, it is an event of the BackgroundWorker class. Along with DoWork and RunWorkerCompleted, two other events you almost always subscribe.

    If I don’t specify “new ProgressChangedEventHandler” still the code compiles ?.

    That’s called “syntax sugar”. The C# compiler can tell what kind of delegate type is required from the event type and will automatically generate the “new ProgressChangedEventHandler” part of the statement as required. Very convenient. IntelliSense however will always generate it. Even the full statement is syntax sugar, you never explicitly assign the Delegate.Target property. It is inferred by the compiler to either null or this, depending on whether the target method is static or not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I don't care whether Thread1 changes Flag1 at the same time Thread2 changes
This is the code of the DoWork event the ProgressChanged event and the RunWorkerCompleted
Thread thread = new Thread(new Runnable() { @Override public void run() { try {
Thread1/2: do TotalThreads-- on their exit int TotalThreads = 2; void AsyncFunc() { //
I wish to have two threads. The first thread1 occasionally calls the following pseudo
look at this code: int data=5; void Thread1() { if(data==5) { //nothing } }
I have two threads and one class. Thread1 updates the local object of the
The threads should start at same split second. I understand, if you do thread1.start()
Consider the following code: private static BackgroundWorker bg = new BackgroundWorker(); static void Main(string[]
NexusConnectedClients = [] class Thread1(NexusCore.Thread): def Run(): global NexusConnectedClients if(IncomingCommand == ADDCLIENT): NewClientOBJ =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.