Stopwatch – An Interesting Class in Diagnostics

Do you know we have a Stopwatch class inside the System.Diagnostics namespace?

Yes! It helps in finding the elapsed time.

For example:

using System.Diagnostics;

 

Stopwatch watch1 = Stopwatch.StartNew();
DoSomeLengthyProcessHere();

watch1.Stop();

MessageBox.Show(watch1.Elapsed.TotalSeconds.ToString()); // Get the elapsed seconds

4 thoughts on “Stopwatch – An Interesting Class in Diagnostics

    1. Jean Paul says:

      Thank You Pawar!

      Stopwatch is a hidden gem in the libraries.

  1. Kiran says:

    Awesome 😀

  2. priya pawar says:

    Hello Jean,

    I want to Practice SP development example online.

    Please can you suggest any source to online practice SP at Home.

Leave a Reply

Your email address will not be published. Required fields are marked *