C # Use StopWatch,
When working on a project, you need to output the database operation time and write a method by yourself. When the boss saw it, he wondered why I didn't need it. To know the StopWatch class.
Attribute
|
Name |
Description |
|
Elapsed |
Obtains the total running time measured by the current instance. |
|
ElapsedMilliseconds |
Obtains the total running time (in milliseconds) measured by the current instance ). |
|
ElapsedTicks |
Obtains the total running time measured by the current instance (expressed by the timer scale ). |
|
IsRunning |
Gets a value indicating whether the Stopwatch timer is running. |
Method
|
Name |
Description |
|
Equals (Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object .) |
|
Finalize () |
Allow the object to try to release resources and perform other cleanup operations before garbage collection. (Inherited from Object .) |
|
GetHashCode () |
As the default hash function. (Inherited from Object .) |
|
GetTimestamp () |
Obtains the current scale in the timer mechanism. |
|
GetType () |
Obtain the Type of the current instance. (Inherited from Object .) |
|
MemberwiseClone () |
Creates a superficial copy of the current Object. (Inherited from Object .) |
|
Reset () |
Stop interval measurement, and reset the running time to zero. |
|
Restart () |
Stop interval measurement, reset the running time to zero, and start measuring the running time. |
|
Start () |
Start or continue to measure the running time at a certain interval. |
|
StartNew () |
Initialize a new Stopwatch instance, set the runtime attribute to zero, and start measuring the runtime. |
|
Stop () |
Stops the running time of a measurement interval. |
|
ToString () |
Returns the string of the current object. (Inherited from Object .) |