Wednesday, March 2, 2011

measure of response in method

I had the task to test a method and measure how much time was taken.

Here is how i did it:


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

FillDropDownList();
buttonContinue.Text = "it take... (ms): " + sw.ElapsedMilliseconds;

sw.Stop();


Notice that in order to use StopWatch you will need the System.Diagnostics.

No comments: