System.Diagnostics.Stopwatch.Elapsed Property

Gets the total elapsed time measured by the current instance.


public TimeSpan Elapsed { get; }


Documentation for this section has not yet been entered.


In a typical System.Diagnostics.Stopwatch scenario, you call the Stopwatch.Start method, then eventually call the Stopwatch.Stop method, and then you check elapsed time using the Stopwatch.Elapsed property.

Use the Stopwatch.Elapsed property to retrieve the elapsed time value using TimeSpan methods and properties. For example, you can format the returned TimeSpan instance into a text representation, or pass it to another class that requires a TimeSpan parameter.

You can query the properties Stopwatch.Elapsed, Stopwatch.ElapsedMilliseconds, and Stopwatch.ElapsedTicks while the System.Diagnostics.Stopwatch instance is running or stopped. The elapsed time properties steadily increase while the System.Diagnostics.Stopwatch is running; they remain constant when the instance is stopped.

By default, the elapsed time value of a System.Diagnostics.Stopwatch instance equals the total of all measured time intervals. Each call to Stopwatch.Start begins counting at the cumulative elapsed time; each call to Stopwatch.Stop ends the current interval measurement and freezes the cumulative elapsed time value. Use the Stopwatch.Reset method to clear the cumulative elapsed time in an existing System.Diagnostics.Stopwatch instance.


Namespace: System.Diagnostics
Assembly: System (in System.dll)
Assembly Versions:,
Since: .NET 2.0