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
Get step-by-step solutions from verified subject matter experts
