What should you do?

You are creating a Windows application by using the .NET Framework 3.5. The application processes a large number of records. The records are processed on a separate thread. Occasionally, the record processing takes a long time. You add a Cancel button to the form. You also add an AutoResetEvent object on the user
interface thread, and set the default value of the object to false. You plan to perform the following steps in sequence:

* After every record is processed, read the value of the AutoResetEvent object by using the AutoResetEvent.WaitOne method.
* When the value of the AutoResetEvent object is True, discontinue the record processing.

You need to modify the Click event handler of the Cancel button to change the value of the AutoResetEvent object. What should you do?

You are creating a Windows application by using the .NET Framework 3.5. The application processes a large number of records. The records are processed on a separate thread. Occasionally, the record processing takes a long time. You add a Cancel button to the form. You also add an AutoResetEvent object on the user
interface thread, and set the default value of the object to false. You plan to perform the following steps in sequence:

* After every record is processed, read the value of the AutoResetEvent object by using the AutoResetEvent.WaitOne method.
* When the value of the AutoResetEvent object is True, discontinue the record processing.

You need to modify the Click event handler of the Cancel button to change the value of the AutoResetEvent object. What should you do?

A.
Call the EndInvoke method.

B.
Call the Thread.Abort method.

C.
Call the Set method of the AutoResetEvent object.

D.
Call the Reset method of the AutoResetEvent object.



Leave a Reply 0

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