Category Archives: C#

Measuring execution times in .NET

C#

var watch = Stopwatch.StartNew();
// the code that you want to measure comes here
watch.Stop();
var elapsedMs = watch.ElapsedMilliseconds;

Taken from: http://stackoverflow.com/questions/14019510/calculate-the-execution-time-of-a-method