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

Not() public static method

Creates a UnaryExpression that represents a bitwise complement operation.
/// is null. The unary not operator is not defined for .Type.
public static Not ( Expression expression ) : UnaryExpression
expression Expression An to set the property equal to.
return UnaryExpression
        public static UnaryExpression Not(Expression expression)
        {
            return Not(expression, method: null);
        }

Same methods

Expression::Not ( Expression expression, MethodInfo method ) : UnaryExpression

Usage Example

Ejemplo n.º 1
0
        protected override object VisitIf(If I)
        {
            string name = target.LabelName();

            LinqExprs.LabelTarget _else = LinqExpr.Label("if_" + name + "_else");
            LinqExprs.LabelTarget end   = LinqExpr.Label("if_" + name + "_end");

            // Check the condition, exit if necessary.
            target.Add(LinqExpr.IfThen(LinqExpr.Not(target.Compile(I.Condition)), LinqExpr.Goto(_else)));

            // Execute true code.
            target.PushScope();
            Visit(I.True);
            target.PopScope();
            target.Add(LinqExpr.Goto(end));

            // Execute false code.
            target.Add(LinqExpr.Label(_else));
            target.PushScope();
            Visit(I.False);
            target.PopScope();

            // Exit point.
            target.Add(LinqExpr.Label(end));
            return(null);
        }
All Usage Examples Of System.Linq.Expressions.Expression::Not
Expression