So in two recent small little projects, I have needed to "time" things in code. Back in the day, it was using timespans, timers in windows forms, ticks, and just two dates and taking datediffs, getting the milliseconds or seconds, coverting to the time element you needed. Well, no longer do you have to hack your way through all that! There is a Stopwatch class in System.Diagnostics!! pseudo C# code to follow:
Stopwatch _stopwatch = new Stopwatch();
… do you things here…
_stopwatch.Elapsed. <every time element you need here>
This totally rocks and I see myself using it more and more. Pretty sweet! System.Diagnostics has a ton of cool things – go explore it!