Stopwatch
Stopwatch sw = new Stopwatch(); sw.Start(); // your code here sw.Stop(); TimeSpan elapsedTime = sw.Elapsed;