Did you know that there was a Stopwatch object in .NET? Me either. Apparently it was added in the .NET Framework in version 2.0 and no one told me. Imagine that.

Seriously though I have often had to add some code in various projects to understand how long an algorithm was taking to execute. Generally this meant a query to the system clock in some way, saving the current value (after figuring out what data type and units of measure it was using), then checking the value again later and doing some math to figure out elapsed time. Sure it was doable and often I wound up creating some set of functions to make my life easier. But it was a bit of work to teach beginners how to use it. Suddenly my life is easier though.

The documentation for the Stopwatch class in online here. There is even sample code for using it in both Visual Basic, C# C++, J# and JScript. Check it out. I'll bet you'll find it a lot easier to use than a lot of other things you may have been using to time activities.

 By the way there is a survey going on about the Education blogosphere so if you are an education blogger you may want to participate.

Blogosphere_survey_button