public static Expression GenerateNotEqual(Expression left, Expression right)
        {
            OptimizeForEqualityIfPossible(ref left, ref right);

            ConstantExpressionWrapper.Wrap(ref left);
            ConstantExpressionWrapper.Wrap(ref right);

            return(Expression.NotEqual(left, right));
        }
        public static Expression GenerateLessThanEqual(Expression left, Expression right)
        {
            if (left.Type == typeof(string))
            {
                return(Expression.LessThanOrEqual(GenerateStaticMethodCall("Compare", left, right), Expression.Constant(0)));
            }

            if (left.Type.GetTypeInfo().IsEnum || right.Type.GetTypeInfo().IsEnum)
            {
                return(Expression.LessThanOrEqual(left.Type.GetTypeInfo().IsEnum ? Expression.Convert(left, Enum.GetUnderlyingType(left.Type)) : left,
                                                  right.Type.GetTypeInfo().IsEnum ? Expression.Convert(right, Enum.GetUnderlyingType(right.Type)) : right));
            }

            ConstantExpressionWrapper.Wrap(ref left);
            ConstantExpressionWrapper.Wrap(ref right);

            return(Expression.LessThanOrEqual(left, right));
        }
        public static Expression GenerateGreaterThan(Expression left, Expression right)
        {
            if (left.Type == typeof(string))
            {
                return(Expression.GreaterThan(GenerateStaticMethodCall("Compare", left, right), Expression.Constant(0)));
            }

            if (left.Type.GetTypeInfo().IsEnum || right.Type.GetTypeInfo().IsEnum)
            {
                var leftPart  = left.Type.GetTypeInfo().IsEnum ? Expression.Convert(left, Enum.GetUnderlyingType(left.Type)) : left;
                var rightPart = right.Type.GetTypeInfo().IsEnum ? Expression.Convert(right, Enum.GetUnderlyingType(right.Type)) : right;
                return(Expression.GreaterThan(leftPart, rightPart));
            }

            ConstantExpressionWrapper.Wrap(ref left);
            ConstantExpressionWrapper.Wrap(ref right);

            return(Expression.GreaterThan(left, right));
        }