Additionally, Nullable<T> == null syntax is, IIRC, syntactic sugar for Nullable<T>.HasValue.
On Tue, Dec 7, 2010 at 11:13 AM, David Pfeffer <[email protected]> wrote: > Nullable<T> is defined as a struct, a value type. > > [SerializableAttribute] > public struct Nullable<T> > where T : struct, new() > > http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx > > > On Tue, Dec 7, 2010 at 11:12 AM, Patrick Earl <[email protected]> wrote: > >> 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. >>>> >>>> >>> >> >
