+6  A: 

If you're looking for time measurements, use the Stopwatch class.

This allows you to easily measure some time using the Start() and Stop() method. The Elapsed property will then tell you how long the operation took.

Pieter
+3  A: 

You could use the Stopwatch class to measure time:

var watch = Stopwatch.StartNew();
SomeFunctionThatCallsYourAlgorithm();
watch.Stop();
Console.WriteLine("algorithm execution time: {0}ms", watch.ElapsedMilliseconds);
Darin Dimitrov
A: 

There's some code from Vance Morrison's weblog that uses the Stopwatch class (as described above), but does multiple runs and performs some statistical analysis to give you the mean, median runtime, along with the standard derivation.

Check it out here: http://blogs.msdn.com/b/vancem/archive/2006/09/21/765648.aspx

Travis