Which code segment should you insert at line 14?

An application contains code that measures reaction times. The code runs the timer on a
thread separate from the user interface. The application includes the following code. (Line
numbers are included for reference only.)

You need to ensure that the application cancels the timer when the user presses the Enter key.
Which code segment should you insert at line 14?

An application contains code that measures reaction times. The code runs the timer on a
thread separate from the user interface. The application includes the following code. (Line
numbers are included for reference only.)

You need to ensure that the application cancels the timer when the user presses the Enter key.
Which code segment should you insert at line 14?

A.
tokenSource.Token.Register( () => tokenSource.Cancel() );

B.
tokenSource.Cancel();

C.
tokenSource.IsCancellationRequested = true;

D.
tokenSource.Dispose();



Leave a Reply 2

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