Date comparison with MaxValue not working

Viewed 2982

I have a nullable Date property called BoughtDate. I am trying the following:

if( item.BoughtDate.Value.Equals( DateTime.MaxValue) ) item.BoughtDate= null;

also tried this:

if( item.BoughtDate.Equals( DateTime.MaxValue) ) item.BoughtDate=null;

When debugging, my BoughtDate and DateTime.MaxValue seems exactly the same - yet it says it is not the same(does not set my item.BoughtDate to null)

Why does my comparison not work?

4 Answers
Related