C # Use StopWatch,

Source: Internet
Author: User

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 .)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.