다음을 통해 공유


Expression.Decrement 메서드

정의

1씩 감소하는 식을 나타내는 UnaryExpression을 만듭니다.

오버로드

Decrement(Expression)

1씩 감소하는 식을 나타내는 UnaryExpression을 만듭니다.

Decrement(Expression, MethodInfo)

1씩 감소하는 식을 나타내는 UnaryExpression을 만듭니다.

Decrement(Expression)

Source:
UnaryExpression.cs
Source:
UnaryExpression.cs
Source:
UnaryExpression.cs

1씩 감소하는 식을 나타내는 UnaryExpression을 만듭니다.

public:
 static System::Linq::Expressions::UnaryExpression ^ Decrement(System::Linq::Expressions::Expression ^ expression);
public static System.Linq.Expressions.UnaryExpression Decrement (System.Linq.Expressions.Expression expression);
static member Decrement : System.Linq.Expressions.Expression -> System.Linq.Expressions.UnaryExpression
Public Shared Function Decrement (expression As Expression) As UnaryExpression

매개 변수

expression
Expression

감소시킬 Expression입니다.

반환

감소되는 식을 나타내는 UnaryExpression입니다.

예제

다음 코드 예제에서는 지정된 값에서 1을 빼는 식을 만드는 방법을 보여 줍니다.

// Add the following directive to your file:
// using System.Linq.Expressions;

double num = 5.5;

// This expression represents a decrement operation
// that subtracts 1 from a value.
Expression decrementExpr = Expression.Decrement(
                            Expression.Constant(num)
                        );

// Print expression.
Console.WriteLine(decrementExpr.ToString());

// The following statement first creates an expression tree,
// then compiles it, and then executes it.
Console.WriteLine(
    Expression.Lambda<Func<double>>(decrementExpr).Compile()());

// The value of the variable did not change,
// because the expression is functional.
Console.WriteLine("object: " + num);

// This code example produces the following output:
//
// Decrement(5.5)
// 4.5
// object: 5.5
' Add the following directive to your file:
' Imports System.Linq.Expressions   

Dim num As Double = 5.5

' This expression represents a decrement operation 
' that subtracts 1 from a value. 
Dim decrementExpr As Expression = Expression.Decrement(
                            Expression.Constant(num)
                        )

' Print the expression.
Console.WriteLine(decrementExpr.ToString())

' The following statement first creates an expression tree,
' then compiles it, and then executes it.
Console.WriteLine(
    Expression.Lambda(Of Func(Of Double))(decrementExpr).Compile()())

' The value of the variable did not change,
' because the expression is functional.
Console.WriteLine("object: " & num)

' This code example produces the following output:
'
' Decrement(5.5)
' 4.5
' object: 5.5

설명

이 식은 작동하며 전달된 개체의 값을 변경하지 않습니다.

적용 대상

Decrement(Expression, MethodInfo)

Source:
UnaryExpression.cs
Source:
UnaryExpression.cs
Source:
UnaryExpression.cs

1씩 감소하는 식을 나타내는 UnaryExpression을 만듭니다.

public:
 static System::Linq::Expressions::UnaryExpression ^ Decrement(System::Linq::Expressions::Expression ^ expression, System::Reflection::MethodInfo ^ method);
public static System.Linq.Expressions.UnaryExpression Decrement (System.Linq.Expressions.Expression expression, System.Reflection.MethodInfo method);
public static System.Linq.Expressions.UnaryExpression Decrement (System.Linq.Expressions.Expression expression, System.Reflection.MethodInfo? method);
static member Decrement : System.Linq.Expressions.Expression * System.Reflection.MethodInfo -> System.Linq.Expressions.UnaryExpression
Public Shared Function Decrement (expression As Expression, method As MethodInfo) As UnaryExpression

매개 변수

expression
Expression

감소시킬 Expression입니다.

method
MethodInfo

구현 메서드를 나타내는 MethodInfo입니다.

반환

감소되는 식을 나타내는 UnaryExpression입니다.

설명

이 식은 작동하며 전달된 개체의 값을 변경하지 않습니다.

적용 대상