1

How long need a portion of code to be executed ?

Posted December 4th, 2009 in .NET, Development, Source Code, Tips and Tricks by Sam Beauvois

Use the Stopwatch object !

using System.Diagnostics;

// ...

Stopwatch myStopWatch = Stopwatch.StartNew();

// some code

myStopWatch.Stop();

Console.WriteLine("{0} ms - {1} ticks", myStopWatch.Elapsed.TotalMilliseconds, myStopWatch.ElapsedTicks);

// ...

One Response so far.

  1. WP Themes says:

    Amiable fill someone in on and this post helped me alot in my college assignement. Say thank you you as your information.

Leave a Reply