Provides a set of methods and properties that you can use to accurately measure elapsed time.
| C# | Visual Basic |
public class Stopwatch
Public Class Stopwatch
| All Members | Constructors | Methods | Properties | Fields | |
| Icon | Member | Description |
|---|---|---|
| Stopwatch()()() |
Initializes a new instance of the Stopwatch class.
| |
| Elapsed |
Gets the total elapsed time measured by the current instance.
| |
| ElapsedMilliseconds |
Gets the total elapsed time measured by the current instance, in milliseconds.
| |
| ElapsedTicks |
Gets the total elapsed time measured by the current instance, in timer ticks.
| |
| Equals(Object) | (Inherited from Object.) | |
| Finalize()()() | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
| Frequency |
Gets the frequency of the timer as the number of ticks per second.
| |
| GetHashCode()()() | Serves as a hash function for a particular type. GetHashCode()()() is suitable for use in hashing algorithms and data structures like a hash table. (Inherited from Object.) | |
| GetTimestamp()()() |
Gets the current number of ticks in the timer mechanism.
| |
| GetType()()() | Gets the Type of the current instance. (Inherited from Object.) | |
| IsHighResolution |
Indicates whether the timer is based on a high-resolution performance counter.
| |
| IsRunning |
Gets a value indicating whether the Stopwatch timer is running.
| |
| MemberwiseClone()()() | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| Reset()()() |
Stops time interval measurement and resets the elapsed time to zero.
| |
| Start()()() |
Starts, or resumes, measuring elapsed time for an interval.
| |
| StartNew()()() |
Initializes a new Stopwatch instance, sets the elapsed time property to zero, and starts measuring elapsed time.
| |
| Stop()()() |
Stops measuring elapsed time for an interval.
| |
| ToString()()() | (Inherited from Object.) |
| Object | |
| Stopwatch | |
[!:System.Diagnostics.Stopwatch]