Stopwatch is a litle class in the Diagostics namespace wich is very handy for detecting the bottlenecks in time consuming processes.

Get the elapsed time..

Normally I measured the elapsed time with something like this:

            DateTime start = DateTime.Now;
            // Do some processing
            DateTime end = DateTime.Now;
            TimeSpan elapsedTime = end.Subtract(start);

With the StopWacht class this is getting a litle easier, like this:

            Stopwatch stopwatch = new Stopwatch();
            // Do some processing
            // Do some more processing

So now it's easyer to messure the elapsed time of specific processes!




Saving your comment....

Naam is verplicht!
Email is verplicht!
Opmerking is verplicht!