I want to measure the execution of a piece of code and I\'m wondering what the best method to do this is?
Option 1:
DateTime StartTime = DateTime.Now
It's not just that StopWatch is more accurate, but also that DateTime.Now will give incorrect results in some circumstances.
StopWatch
DateTime.Now
Consider what happens during a daylight saving time switch-over, for example — using DateTime.Now can actually give a negative answer!