1
I’m having trouble using the null coalescing in the case below:
When trying to use operand ??
to validate if the value reader["Data"]
is void, and if the DateTime.MinValue
.
The error that returns is:
Operator ?? cannot be apllied to operands of type 'Datetime' and 'Datetime'
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
vendasConfirmadas.Select(v => new Pedido()
{
Data = Convert.ToDateTime(reader["Data"]) ?? DateTime.MinValue
});
}
}
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site
– Maniero