When I do the following I get:
inv.RSV = pid.RSVDate
I get the following: cannot implicitly convert type System.DateTime? to System.DateTime.
In this case, inv.RSV is DateTime and pid.RSVDate is DateTime?
I tried the following but was not successful:
if (pid.RSVDate != null)
{
inv.RSV = pid.RSVDate != null ? pid.RSVDate : (DateTime?)null;
}
If pid.RSVDate is null, I like to not assign inv.RSV anything in which case it will be null.
DateTime can’t be null. It’s default is
DateTime.MinValue.What you want to do is the following:
Or, more succinctly: