Use of C # stopwatch

Source: Internet
Author: User

When you do the project, you need to output the database operation time-consuming, wrote a method. When the boss saw it, I wondered why I didn't have to. Only to know that there are stopwatch this class.

Properties
name description
Elapsed

Gets the total elapsed time measured by the current instance.

Elapsedmilliseconds

Gets the total elapsed time, in milliseconds, measured by the current instance.

Elapsedticks

Gets the total elapsed time measured by the current instance, expressed in a timer scale.

IsRunning

Gets a value that indicates whether the Stopwatch timer is running.

Method
name description
Equals(Object)

Determines whether the specified object is equal to the current object. (Inherit from Object.) )

Finalize()

Allows the object to attempt to free resources and perform other cleanup operations before garbage collection reclaims an object. (Inherit from Object.) )

GetHashCode()

As the default hash function. (Inherit from Object.) )

Gettimestamp()

Gets the current number of ticks in the timer mechanism.

GetType()

Gets the Type of the current instance. (Inherit from Object.) )

MemberwiseClone()

Creates a shallow copy of the current Object. (Inherit from Object.) )

Reset()

Stops the interval measurement and resets the run time to zero.

Restart()

Stop the interval measurement, reset the run time to zero, and start measuring elapsed time.

Start()

Start or continue measuring the elapsed time of an interval.

StartNew()

Initializes a new Stopwatch instance, sets the run time property to zero, and then starts measuring elapsed time.

Stop()

Stops measuring the elapsed time of an interval.

ToString()

Returns a String that represents the current object. (Inherit from Object.) )

Use of C # stopwatch

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.