My friend Jake and I were talking about doing quick performance tests on exception handling. We can definitely use this handy class to help out with that.
using System.Diagnostics; [Test] public void StringBuilderTest() { Stopwatch watch = new Stopwatch(); watch.Start(); StringBuilder sb = new StringBuilder(); int iterations = 10000000; // 10 million for (int i = 0; i < iterations; i++) { sb.Append(i); } watch.Stop(); Console.Write("Elapsed Time: " + watch.Elapsed); }More Info: MSDN: Stopwatch Class