Go to Comments





How to measure code performance in c# by measuring execution time


Created: 08/01/2016 07:24:19 p.m.







How to measure code performance in c# by measuring execution time.




using System.Diagnostics;


Stopwatch sw = new Stopwatch();
sw.Start();

// ... Your code to test goes here...

sw.Stop();

Console.WriteLine("Elapsed={0}",sw.Elapsed); // Print the result.







Comments: