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

Or() public static method

Creates a BinaryExpression that represents an bitwise OR operation.
public static Or ( Expression left, Expression right, MethodInfo method ) : BinaryExpression
left Expression An to set the property equal to.
right Expression An to set the property equal to.
method System.Reflection.MethodInfo A to set the property equal to.
return BinaryExpression
        public static BinaryExpression Or(Expression left, Expression right, MethodInfo method)
        {
            RequiresCanRead(left, nameof(left));
            RequiresCanRead(right, nameof(right));
            if (method == null)
            {
                if (left.Type == right.Type && left.Type.IsIntegerOrBool())
                {
                    return new SimpleBinaryExpression(ExpressionType.Or, left, right, left.Type);
                }
                return GetUserDefinedBinaryOperatorOrThrow(ExpressionType.Or, "op_BitwiseOr", left, right, liftToNull: true);
            }
            return GetMethodBasedBinaryOperator(ExpressionType.Or, left, right, method, liftToNull: true);
        }

Same methods

Expression::Or ( Expression left, Expression right ) : BinaryExpression

Usage Example

Exemplo n.º 1
0
 public override Expression<Func<Unbrickable.Models.Post, bool>> filterPosts(Expression<Func<Unbrickable.Models.Post, bool>> predicate)
 {
     if (operation != 1 && operation != 2 && operation != 3)
     {
         return predicate;
     }
     if (this.isOr)
     {
         Debug.WriteLine("Or " + this.operation + " on " + this.date.Date);
         switch (operation)
         {
             case 1: return predicate.Or(x => DbFunctions.TruncateTime(x.date_posted) >= this.date);
             case 2: return predicate.Or(x => DbFunctions.TruncateTime(x.date_posted) <= this.date);
             case 3: return predicate.Or(x => DbFunctions.TruncateTime(x.date_posted) == this.date);
             default: return predicate;
         }
     }
     else
     {
         Debug.WriteLine("And " + this.operation + " on " + this.date.Date);
         switch (operation)
         {
             case 1: return predicate.And(x => DbFunctions.TruncateTime(x.date_posted) >= this.date);
             case 2: return predicate.And(x => DbFunctions.TruncateTime(x.date_posted) <= this.date);
             case 3: return predicate.And(x => DbFunctions.TruncateTime(x.date_posted) == this.date);
             default: return predicate;
         }
     }
 }
All Usage Examples Of System.Linq.Expressions.Expression::Or
Expression