If you're using C# 2 then you can use the Nullable generic type:
public DateTime? SelectedValue
{
get / set;
}
Note the question mark which is short-hand for Nullable<DateTime>. See the
Nullable API doc for more details. If you're using C# 1.0 then you'll need
to either store in a reference type (object) or pick a DateTime to equate to
null (eg. DateTime.MinValue). Alternatively, use an extra bool field to
indicate null.
HTH,
Kent
"Daves" <db****@simnet.is> wrote in message
news:OX**************@TK2MSFTNGP15.phx.gbl...
a get { ... } for public property SelectedValue returns DateTime type to be
used as a parameter in a Sql update query but I'd like it to return "empty"
if no date has been selected...
I cannot use
return null;
because "Cannot convert null to 'System.DateTime' because it is a value
type"
How can this be done?