Tags:

.NET bug on DateTime.MaxValue?

03/08/2007 13:14

Not sure if my problem can be considered as a bug. But when I try to compare a DateTime with MaxValue, it already returns false.

Code:
DateTime aDate = DateTime.MaxValue;
Console.WriteLine(DateTime.Compare(DateTime.MaxValue, aDate));

Very simply code, can you guess what you will get “0″, which means they are not equal!!

Some people says it caused by “DateTime.MaxValue is not serializable” (http://blogs.ugidotnet.org/teo/archive/2005/11/21/30271.aspx)