What code segment should you use to increase the counter by one?

You have developed w Web application will be integrated into Domain.com’s existing e-Commerce Web application. The Web application contains a performance counter that records the number of requests to the Products table in the CKProducts database.
The code for the counter is shown in the following exhibit.

Dim cntr As PerformanceCounter = _
New PerformaceCounter("Table Requests", "Products", False)

You need to increase the counter by one.
What code segment should you use?

You have developed w Web application will be integrated into Domain.com’s existing e-Commerce Web application. The Web application contains a performance counter that records the number of requests to the Products table in the CKProducts database.
The code for the counter is shown in the following exhibit.

Dim cntr As PerformanceCounter = _
New PerformaceCounter(“Table Requests”, “Products”, False)

You need to increase the counter by one.
What code segment should you use?

A.
cntr.NextSample()

B.
cntr.RawValue = cntr.NextSame().RawValue

C.
cntr.NextValue()

D.
cntr.Increment()

Explanation:

The Increment method of the PerformanceCounter class is used to increase the counter by one.

Incorrect Answers:
A: The NextSample method of the PerformanceCounter class returns the next sample of data for the counter. It does not increase the counter by one.
B: This code does not increase the counter by one.
C: The NextValue method of the PerformanceCounter class returns the next value for the counter. It does not increase the counter by one.



Leave a Reply 0

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