Question: C# Design a class named StopWatch in C # . The class contains: -Public DateTime fields startTime and endTime. -A default (no parameters) constructor that

C#

Design a class named StopWatch in C #. The class contains:

-Public DateTime fields startTime and endTime. -A default (no parameters) constructor that initializes startTime with the current time (DateTime.Now). For the best implementation, call Start() -A method named Start() that resets the startTime to the current time. -A method named Stop() that sets the endTime to the current time. -A method named GetElapsedTime() that returns the elapsed time for the stopwatch in milliseconds.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!