← Interactive API Explorer
Namespace: System.Diagnostics

Stopwatch

Provides a set of methods and properties that you can use to accurately measure elapsed time.

Properties (3)

TimeSpan Elapsed
Gets the total elapsed time measured by the current instance.
Value: A read-only TimeSpan representing the total elapsed time measured by the current instance.
long ElapsedMilliseconds
Gets the total elapsed time measured by the current instance, in milliseconds.
Value: A read-only long integer representing the total number of milliseconds measured by the current instance.
long ElapsedTicks
Gets the total elapsed time measured by the current instance, in timer ticks.
Value: A read-only long integer representing the total number of timer ticks measured by the current instance.

Methods (6)

void Start
Starts, or resumes, measuring elapsed time for an interval.
void Stop
Stops measuring elapsed time for an interval.
void Reset
Stops time interval measurement and resets the elapsed time to zero.
void Restart
Stops time interval measurement, resets the elapsed time to zero, and starts measuring elapsed time.
Stopwatch StartNew
Initializes a new Stopwatch instance, sets the elapsed time property to zero, and starts measuring elapsed time.
Returns: A Stopwatch that has just begun measuring elapsed time.
long GetTimestamp
Gets the current number of ticks in the timer mechanism.
Returns: A long integer representing the tick counter value of the underlying timer mechanism.