Use Stopwatch to measure the time taken to execute the code.
By [)ia6l0 iii
You can use the StopWatch class from the System.Diagnostics namespace to measure time taken to execute a certain block of code
Stopwatch myWatch = new Stopwatch();
myWatch.Start();
//your code
myWatch.Stop();
string timeTaken = string.Format(""{0} was taken to execute the code."",
myWatch.ElapsedMilliseconds);
Use Stopwatch to measure the time taken to execute the code. (862 Views)