I don't get it.  Nullable<T> is a reference type.  This works for me:

            ParameterExpression param = Expression.Parameter(typeof(int?),
"hi");
            Expression expr = Expression.NotEqual(param,
Expression.Constant(null));
            var r1 = Expression.Lambda<Func<int?, bool>>(expr,
param).Compile().Invoke(3);
            var r2 = Expression.Lambda<Func<int?, bool>>(expr,
param).Compile().Invoke(null);

Am I totally missing something?

        Patrick Earl

On Tue, Dec 7, 2010 at 8:42 AM, Wenig, Stefan <[email protected]>wrote:

>  silly wording. forget the tree, you just can't create the expression.
>  ------------------------------
> *From:* [email protected] [
> [email protected]] on behalf of Wenig, Stefan [
> [email protected]]
> *Sent:* Tuesday, December 07, 2010 16:41
>
> *To:* [email protected]
> *Subject:* RE: [nhibernate-development] Fwd: NHibernate 3 GA, Linq and
> VB.NET
>
>   Unfortunately no, an expression tree can't contain an expression that
> compares an Nullable<T> to null (value type vs. reference type).
>
>
> Stefan
>
>
>  ------------------------------
> *From:* [email protected] [
> [email protected]] on behalf of Patrick Earl [
> [email protected]]
> *Sent:* Tuesday, December 07, 2010 16:11
> *To:* [email protected]
> *Subject:* Re: [nhibernate-development] Fwd: NHibernate 3 GA, Linq and
> VB.NET
>
>  Could not HasValue be transformed to !=null by ReLinq?
>
>        Patrick Earl
>
> On Tue, Dec 7, 2010 at 7:39 AM, Wenig, Stefan <[email protected]>wrote:
>
>>  James has posted on nhusers, I took it here. If he tries, it should
>> resolve the problems with VB-specific string comparisons. Null handling
>> needs to be supported by code in NH.
>>
>>
>

Reply via email to