Which code segment should you use?

You want to execute an event handler asynchronously from a Windows Form. You need to write code that uses the BackgroundWorker component named bgwExecute to execute the WorkHandler method. Which code segment should you use?

You want to execute an event handler asynchronously from a Windows Form. You need to write code that uses the BackgroundWorker component named bgwExecute to execute the WorkHandler method. Which code segment should you use?

A.
EventHandler work = new EventHandler(WorkHandler);
bgwExecute.RunWorkerAsync(Work);

B.
ThreadStart tsBackground = new ThreadStart(WorkHandler);
bgwExecute.ReporterProgress(100, tsBackground);

C.
ThreadStart tsBackground = new ThreadStart(WorkHandler);
bgwExecute.RunWorkerAsync(tsBackground);

D.
bgwExecute.DoWork += new Do WorkEventHandler(WorkHandler);
bgwExecute.RunWorkerAsync();



Leave a Reply 0

Your email address will not be published. Required fields are marked *