Hi I am trying to return a collection which may potentially have null date values. However, if they are null - I want to keep them that way and not just use a arbitrary date instead.
If it was a string, I'd check for nulls like thus:
calEventDTO.occurrenceType = dr.IsDBNull(10) ? null : dr.GetString(10);
How would I do the same for a date? The following doesn't compile (There is no implicit conversion between 'null' and System.DateTime').
calEventDTO.recurrenceID = dr.IsDBNull(9) ? null : dr.GetDateTime(9);
My dto is set up to deal with null values.
public DateTime? recurrenceID
{
get { return _recurrenceID; }
set { _recurrenceID = value; }
}
Any hints/help/pointers much appreciated. thanks