Looking for a better way to compare a nullable date time than the following:
Any suggestions?
// myobject.ExpireDatetime is of DateTime?
//
if (!myobject.ExpireDateTime.IsNull() && DateTime.Compare((DateTime)myobject.ExpireDateTime, DateTime.Now.ToUniversalTime()) < 0)
{ //error! }
See Question&Answers more detail:osEdited: Sorry for confusion...myobject.ExpireDatetime is of type DateTime.