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

AndAssign() public static method

Creates a BinaryExpression that represents a bitwise AND assignment operation.
public static AndAssign ( Expression left, Expression right, MethodInfo method, LambdaExpression conversion ) : 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.
conversion LambdaExpression A to set the property equal to.
return BinaryExpression
        public static BinaryExpression AndAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion)
        {
            RequiresCanRead(left, nameof(left));
            RequiresCanWrite(left, nameof(left));
            RequiresCanRead(right, nameof(right));
            if (method == null)
            {
                if (left.Type == right.Type && left.Type.IsIntegerOrBool())
                {
                    // conversion is not supported for binary ops on arithmetic types without operator overloading
                    if (conversion != null)
                    {
                        throw Error.ConversionIsNotSupportedForArithmeticTypes();
                    }
                    return new SimpleBinaryExpression(ExpressionType.AndAssign, left, right, left.Type);
                }
                return GetUserDefinedAssignOperatorOrThrow(ExpressionType.AndAssign, "op_BitwiseAnd", left, right, conversion, liftToNull: true);
            }
            return GetMethodBasedAssignOperator(ExpressionType.AndAssign, left, right, method, conversion, liftToNull: true);
        }

Same methods

Expression::AndAssign ( Expression left, Expression right ) : BinaryExpression
Expression::AndAssign ( Expression left, Expression right, MethodInfo method ) : BinaryExpression

Usage Example

コード例 #1
0
        protected override object VisitAssignment(Assignment A)
        {
            LinqExpr value = target.Compile(A.Value);

            switch (A.Operator)
            {
            case Operator.Add: target.Add(LinqExpr.AddAssign(target.LookUp(A.Assign), value)); break;

            case Operator.Subtract: target.Add(LinqExpr.SubtractAssign(target.LookUp(A.Assign), value)); break;

            case Operator.Multiply: target.Add(LinqExpr.MultiplyAssign(target.LookUp(A.Assign), value)); break;

            case Operator.Divide: target.Add(LinqExpr.DivideAssign(target.LookUp(A.Assign), value)); break;

            case Operator.Power: target.Add(LinqExpr.PowerAssign(target.LookUp(A.Assign), value)); break;

            case Operator.And: target.Add(LinqExpr.AndAssign(target.LookUp(A.Assign), value)); break;

            case Operator.Or: target.Add(LinqExpr.OrAssign(target.LookUp(A.Assign), value)); break;

            case Operator.Equal:
                LinqExpr x = target.LookUp(A.Assign);
                if (x == null)
                {
                    x = target.DeclInit(A.Assign, A.Value);
                }
                target.Add(LinqExpr.Assign(x, value));
                break;

            default: throw new NotImplementedException("Operator not implemented for assignment.");
            }
            return(null);
        }
All Usage Examples Of System.Linq.Expressions.Expression::AndAssign
Expression