Tuesday, March 29, 2016

Debugging Stopwatch

I found this in my old notes today. I don't know what it's all about.

using (var stopWatch = new DebugTrace("Whatever"))
{
   foreach (var foo in Foos)
   {
      
//do something here
   }
   throw (new Exception(stopWatch.Message));
}

 
 

Addendum 8/23/2018: There is such a thing as a Stopwatch in C#. This touches on them some. This is something like a Timer but different. You measure how long an application took to do its thing with a Stopwatch. The example here is probably all you need.

No comments:

Post a Comment