System.Linq.Expressions.Expression.IsTrue C# (CSharp) 메소드

IsTrue() 공개 정적인 메소드

Returns whether the expression evaluates to true.
public static IsTrue ( Expression expression, MethodInfo method ) : UnaryExpression
expression Expression An to evaluate.
method System.Reflection.MethodInfo A that represents the implementing method.
리턴 UnaryExpression
        public static UnaryExpression IsTrue(Expression expression, MethodInfo method)
        {
            RequiresCanRead(expression, nameof(expression));
            if (method == null)
            {
                if (expression.Type.IsBool())
                {
                    return new UnaryExpression(ExpressionType.IsTrue, expression, expression.Type, null);
                }
                return GetUserDefinedUnaryOperatorOrThrow(ExpressionType.IsTrue, "op_True", expression);
            }
            return GetMethodBasedUnaryOperator(ExpressionType.IsTrue, expression, method);
        }

Same methods

Expression::IsTrue ( Expression expression ) : UnaryExpression

Usage Example

예제 #1
0
        public static Expression And(IEnumerable <Expression> expressions, ParameterExpression parameterExpression)
        {
            Expression overallExpression = Expression.IsTrue(Expression.Constant(true, typeof(bool)));

            if (expressions.Count() == 1)
            {
                overallExpression = expressions.First();
            }

            if (expressions.Count() > 1)
            {
                Expression?start = null;
                foreach (var expression in expressions)
                {
                    start = start == null
                        ? expression
                        : Expression.AndAlso(start, expression);
                }
                if (start != null)
                {
                    overallExpression = start !;
                }
            }

            return(overallExpression);
        }
All Usage Examples Of System.Linq.Expressions.Expression::IsTrue
Expression