System.Linq.Expressions.Expression.UnaryPlus C# (CSharp) Метод

UnaryPlus() публичный статический Метод

Creates a UnaryExpression that represents a unary plus operation.
Thrown when is null. Thrown when is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument. Thrown when is null and the unary minus operator is not defined for .Type (or its corresponding non-nullable type if it is a nullable value type) is not assignable to the argument type of the method represented by method.
public static UnaryPlus ( Expression expression, MethodInfo method ) : UnaryExpression
expression Expression An to set the property equal to.
method MethodInfo A to set the property equal to.
Результат UnaryExpression
        public static UnaryExpression UnaryPlus(Expression expression, MethodInfo method)
        {
            RequiresCanRead(expression, nameof(expression));
            if (method == null)
            {
                if (expression.Type.IsArithmetic())
                {
                    return new UnaryExpression(ExpressionType.UnaryPlus, expression, expression.Type, null);
                }
                return GetUserDefinedUnaryOperatorOrThrow(ExpressionType.UnaryPlus, "op_UnaryPlus", expression);
            }
            return GetMethodBasedUnaryOperator(ExpressionType.UnaryPlus, expression, method);
        }

Same methods

Expression::UnaryPlus ( Expression expression ) : UnaryExpression

Usage Example

        private UnaryExpression UnaryExpression(
            ExpressionType nodeType, System.Type type, JObject obj)
        {
            var operand = this.Prop(obj, "operand", this.Expression);
            var method  = this.Prop(obj, "method", this.Method);

            switch (nodeType)
            {
            case ExpressionType.ArrayLength: return(Expr.ArrayLength(operand));

            case ExpressionType.Convert: return(Expr.Convert(operand, type, method));

            case ExpressionType.ConvertChecked: return(Expr.ConvertChecked(operand, type, method));

            case ExpressionType.Decrement: return(Expr.Decrement(operand, method));

            case ExpressionType.Increment: return(Expr.Increment(operand, method));

            case ExpressionType.IsFalse: return(Expr.IsFalse(operand, method));

            case ExpressionType.IsTrue: return(Expr.IsTrue(operand, method));

            case ExpressionType.Negate: return(Expr.Negate(operand, method));

            case ExpressionType.NegateChecked: return(Expr.NegateChecked(operand, method));

            case ExpressionType.Not: return(Expr.Not(operand, method));

            case ExpressionType.OnesComplement: return(Expr.OnesComplement(operand, method));

            case ExpressionType.PostDecrementAssign: return(Expr.PostDecrementAssign(operand, method));

            case ExpressionType.PostIncrementAssign: return(Expr.PostIncrementAssign(operand, method));

            case ExpressionType.PreDecrementAssign: return(Expr.PreDecrementAssign(operand, method));

            case ExpressionType.PreIncrementAssign: return(Expr.PreIncrementAssign(operand, method));

            case ExpressionType.Quote: return(Expr.Quote(operand));

            case ExpressionType.Throw: return(Expr.Throw(operand, type));

            case ExpressionType.TypeAs: return(Expr.TypeAs(operand, type));

            case ExpressionType.UnaryPlus: return(Expr.UnaryPlus(operand, method));

            case ExpressionType.Unbox: return(Expr.Unbox(operand, type));

            default: throw new NotSupportedException();
            }
        }
All Usage Examples Of System.Linq.Expressions.Expression::UnaryPlus
Expression