The && 'operator cannot be applied to operands like "System.DateTime" and "System.DateTime",

I thought this would work, but apparently this is not happening. Any suggestions please?

if (c.ArrivalTime = DateTime.MinValue && c.ExpiryTime = DateTime.MinValue)
{

}

then I got this, Operator '& &' cannot be applied to operands like "System.DateTime" and "System.DateTime"

+5
source share
2 answers

You need to use ==for equality operations in C #.

See section 1.4 Expressions in the C # Language Specification.

+9
source

you don't need the equality operator ==

Please use this method.

if (c.ArrivalTime == DateTime.MinValue && c.ExpiryTime == DateTime.MinValue)
+4
source

All Articles