Operator '??' cannot be applied to operands of type 'System.DateTime'
??
is the null-coalescing operator.
It doesn't make sense to apply it to a value that cannot be null
.
The nullcoalescing operator cannot be applied by default on a type that is inherently non-nullable like DateTime
. If you wish to use it anyway, you'll have to foresee using DateTime
as a nullable type, using e.g. DateTime? dt;
Your r.ServDate property needs to be nullable:
public DateTime? ServDate { get; set; }
DateTime by default is not nullable