I don’t think I’m going to need to say much about the following code, as anyone with even an inkling of the features of the .NET framework would know that it’s a joke. See the nugget(s) of genius below:
[source:csharp]public static void ToStartofCurrDay(ref DateTime aDate)
{
aDate = aDate.Subtract(aDate.TimeOfDay);
}
public static void ToEndofPrevDay(ref DateTime aDate)
{
aDate = aDate.Subtract(aDate.TimeOfDay);
TimeSpan ts = new TimeSpan(1);
aDate = aDate.Subtract(ts);
}
public static void ToEndofCurrDay(ref DateTime aDate)
{
aDate = aDate - aDate.TimeOfDay;
aDate = aDate.AddHours(23);
aDate = aDate.AddMinutes(59);
aDate = aDate.AddSeconds(59);
aDate = aDate.AddMilliseconds(999);
}[/source]The thing that annoys me about this is that it was written by the lead/architect! The man who should know the framework like the back of his hand. Scary stuff. It’s this kind of thing that inspired my comments about “knowing your tech” in my post about the day job.










November 16, 2006
Another WTF about this post is the lack of comments
November 16, 2006
Dear oh deary me. Even if he didn’t know the interface, typing DateTime and hitting F1 would have found the MSDN page for it.
November 17, 2006
C’mon OJ, go easy on the poor chap, I mean he clearly doesn’t know what day of the week it is
December 31, 2006
You’re absolutely right OJ…it’s sickening! And static member functions too. He definately should have created a MyDateTime class, aggregated the DateTime struct and provided instance members. Who taught that man to code?