I have seen many, many versions of this on SO, but none of them seem to quite work for my needs.
My data comes from a vendor database that allows null for DateTime
Use IsDBNull()
System.Convert.IsDBNull(value);
or if you have a SqlDataReader
SqlDataReader
reader.IsDBNull(ordinal);
And make your DateTime properties to be nullable (DateTime?) and set null in case of DBNull. Field() will automatically do this.
DateTime
DateTime?
null
DBNull
Field()