Linq DateTime expressions wont compare if only one is nullable

Posted by tigermain on Stack Overflow See other posts from Stack Overflow or by tigermain
Published on 2010-06-15T19:32:06Z Indexed on 2010/06/15 19:42 UTC
Read the original article Hit count: 298

Filed under:
|

I have been getting the following exception:

The binary operator GreaterThanOrEqual is not defined for the types 'System.Nullable`1[System.DateTime]' and 'System.DateTime'.

I am getting the left hand expression from a class property which is a nullable datetime variable and my right hand side is using

Expression.Constant(new Nullable<DateTime>(DateTime.Now))

However I still get the above exception despite explicitly setting the right hand expression to a nullable type

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ