DateTime cannot be null. Other than making it a string I know of two options.
First option, use the MinValue (or MaxValue) date as sentinel value. Then have checks for the MinValue where needed.
return DateTime.MinValue;
...
if (Date != DateTime.MinValue)
{
}
Option two, declare the DateTime as nullable. This will not be a DateTime object any longer and you will need to do type conversion when you map the nullable DateTime to a normal DateTime.
public DateTime? Date2
{
get
{
if (calendarTextBox.Text == String.Empty)
{
return null;
}
else
{
return Convert.ToDateTime(calendarTextBox.Text);
}
}
set
{
calendarTextBox.Text = Convert.ToDateTime(value).ToShortDateString();
}
}