Although there has been an incredible development for the
.NET Framework in the past decade and many technologies and tools are added to
enhance the programming experience for software developers, still there are
some basic facts about .NET programming that are not taught well and have had
an important impact on the performance of .NET applications written around the
world and deployed in different scales.
One of these mistakes that has been common among many developers
is the misuse of DateTime.Now property that is
designed for particular purposes but is used widely in circumstances where DateTime.UtcNow property or Stopwatch
class are recommended.
In this article we discover three options for working with DateTime values in the .NET Framework in order to clarify
their internal workings, and where and when they should be used, and then we
discover a quantitative comparison between these options to see why the use of DateTime.Now should be restricted.