System.Linq.Expressions.Expression.IsNullComparison C# (CSharp) Method

IsNullComparison() private static method

private static IsNullComparison ( Expression left, Expression right ) : bool
left Expression
right Expression
return bool
        private static bool IsNullComparison(Expression left, Expression right)
        {
            // If we have x==null, x!=null, null==x or null!=x where x is
            // nullable but not null, then this is treated as a call to x.HasValue
            // and is legal even if there is no equality operator defined on the
            // type of x.
            return IsNullConstant(left)
                ? !IsNullConstant(right) && right.Type.IsNullableType()
                : IsNullConstant(right) && left.Type.IsNullableType();
        }
Expression