Hi,
Welcome to MSDN Newsgroup!
We could write one method to compare the DateTime. At .Net 2.0, the
Nullable structure could be used for this scenario. The parameter type of
this method could be DateTime?.
//-------------------------------
static int CompareDT(DateTime? dt1, DateTime? dt2)
{
if (dt1.HasValue && dt2.HasValue)
return dt1.Value.CompareTo(dt2.Value);
else
return -2; //custom error code
}
//----------------------------------
If dt1 or dt2 is a null value, we should return error code, which assured
that there's no exception will be thrown and this snippet code will always
work.
I hope the above information is useful for you. If you have any questions
or concerns, please feel free to let me know. :)
Best Regards,
Terry Fei[MSFT]
Microsoft Community Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)