I have a logic that does the following:
string myData = Convert.ToDateTime(Info.ClosedDate) == DateTime.MinValue ? String.Empty : "(" + Info.ClosedDate + ")";
It should return ClosedDate in parenthesis if it is not stored as NULL in the database. Otherwise it should return an empty string.
The value of Convert.ToDateTime(Info.ClosedDate)
is 01/01/1900
and the value of DateTime.MinValue
is 1/1/0001 12:00:00 AM
So, the condition will never return String.Empty
Currently the field in the object is represent as :
public string ClosedDate
{
get { return _ClosedDate; }
set { _ClosedDate = value; }
}
What is the best solution?