title: Wrapping StopWatch timing with a delegate or lambda?
body: <p>I'm writing code like this, doing a little quick and dirty timing:</p>
  
  <pre><code>var sw = new Stopwatch();
  sw.Start();
  for (int i = 0; i &lt; 1000; i++)
  {
      b = DoStuff(s);
  }
  sw.Stop();
  Console.WriteLine(sw.ElapsedMilliseconds);
  </code></pre>
  
  <p>Surely there's a way to call this bit of timing code as a fancy-schmancy .NET 3.0 lambda rather than (God forbid) cutting and pasting it a few times and replacing the <strong><code>DoStuff(s)</code></strong> with <strong><code>DoSomethingElse(s)</code></strong>?</p>
  
  <p>I know it can be done as a <code>Delegate</code> but I'm wondering about the lambda way.</p>