Expression.Break 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
GotoExpression break 문을 나타내는 형식을 만듭니다.
오버로드
| Name | Description |
|---|---|
| Break(LabelTarget) |
GotoExpression break 문을 나타내는 형식을 만듭니다. |
| Break(LabelTarget, Expression) |
GotoExpression break 문을 나타내는 형식을 만듭니다. 점프 시 레이블에 전달되는 값을 지정할 수 있습니다. |
| Break(LabelTarget, Type) |
지정된 형식을 GotoExpression 사용하여 break 문을 나타내는 형식을 만듭니다. |
| Break(LabelTarget, Expression, Type) |
지정된 형식을 GotoExpression 사용하여 break 문을 나타내는 형식을 만듭니다. 점프 시 레이블에 전달되는 값을 지정할 수 있습니다. |
Break(LabelTarget)
GotoExpression break 문을 나타내는 형식을 만듭니다.
public:
static System::Linq::Expressions::GotoExpression ^ Break(System::Linq::Expressions::LabelTarget ^ target);
public static System.Linq.Expressions.GotoExpression Break(System.Linq.Expressions.LabelTarget target);
static member Break : System.Linq.Expressions.LabelTarget -> System.Linq.Expressions.GotoExpression
Public Shared Function Break (target As LabelTarget) As GotoExpression
매개 변수
- target
- LabelTarget
LabelTarget 점프 GotoExpression 할 것입니다.
반품
GotoExpression Break와 같고Kind, 속성이 Target 설정target되고, 점프 시 대상 레이블에 전달할 null 값이 있는 A입니다.
예제
다음 예제에서는 메서드를 사용 하는 개체를 포함 LoopExpression 하는 식을 만드는 방법을 보여 줍니다 Break .
// Add the following directive to the file:
// using System.Linq.Expressions;
// Creating a parameter expression.
ParameterExpression value = Expression.Parameter(typeof(int), "value");
// Creating an expression to hold a local variable.
ParameterExpression result = Expression.Parameter(typeof(int), "result");
// Creating a label to jump to from a loop.
LabelTarget label = Expression.Label(typeof(int));
// Creating a method body.
BlockExpression block = Expression.Block(
new[] { result },
Expression.Assign(result, Expression.Constant(1)),
Expression.Loop(
Expression.IfThenElse(
Expression.GreaterThan(value, Expression.Constant(1)),
Expression.MultiplyAssign(result,
Expression.PostDecrementAssign(value)),
Expression.Break(label, result)
),
label
)
);
// Compile and run an expression tree.
int factorial = Expression.Lambda<Func<int, int>>(block, value).Compile()(5);
Console.WriteLine(factorial);
// This code example produces the following output:
//
// 120
' Add the following directive to the file:
' Imports System.Linq.Expressions
' Creating a parameter expression.
Dim value As ParameterExpression =
Expression.Parameter(GetType(Integer), "value")
' Creating an expression to hold a local variable.
Dim result As ParameterExpression =
Expression.Parameter(GetType(Integer), "result")
' Creating a label to jump to from a loop.
Dim label As LabelTarget = Expression.Label(GetType(Integer))
' Creating a method body.
Dim block As BlockExpression = Expression.Block(
New ParameterExpression() {result},
Expression.Assign(result, Expression.Constant(1)),
Expression.Loop(
Expression.IfThenElse(
Expression.GreaterThan(value, Expression.Constant(1)),
Expression.MultiplyAssign(result,
Expression.PostDecrementAssign(value)),
Expression.Break(label, result)
),
label
)
)
' Compile an expression tree and return a delegate.
Dim factorial As Integer =
Expression.Lambda(Of Func(Of Integer, Integer))(block, value).Compile()(5)
Console.WriteLine(factorial)
' This code example produces the following output:
'
' 120
적용 대상
Break(LabelTarget, Expression)
GotoExpression break 문을 나타내는 형식을 만듭니다. 점프 시 레이블에 전달되는 값을 지정할 수 있습니다.
public:
static System::Linq::Expressions::GotoExpression ^ Break(System::Linq::Expressions::LabelTarget ^ target, System::Linq::Expressions::Expression ^ value);
public static System.Linq.Expressions.GotoExpression Break(System.Linq.Expressions.LabelTarget target, System.Linq.Expressions.Expression value);
static member Break : System.Linq.Expressions.LabelTarget * System.Linq.Expressions.Expression -> System.Linq.Expressions.GotoExpression
Public Shared Function Break (target As LabelTarget, value As Expression) As GotoExpression
매개 변수
- target
- LabelTarget
LabelTarget 점프 GotoExpression 할 것입니다.
- value
- Expression
점프 시 연결된 레이블에 전달될 값입니다.
반품
GotoExpression Break와 Kind 같고, 속성이 Target 설정target되고 value 점프 시 대상 레이블에 전달됩니다.
적용 대상
Break(LabelTarget, Type)
지정된 형식을 GotoExpression 사용하여 break 문을 나타내는 형식을 만듭니다.
public:
static System::Linq::Expressions::GotoExpression ^ Break(System::Linq::Expressions::LabelTarget ^ target, Type ^ type);
public static System.Linq.Expressions.GotoExpression Break(System.Linq.Expressions.LabelTarget target, Type type);
static member Break : System.Linq.Expressions.LabelTarget * Type -> System.Linq.Expressions.GotoExpression
Public Shared Function Break (target As LabelTarget, type As Type) As GotoExpression
매개 변수
- target
- LabelTarget
LabelTarget 점프 GotoExpression 할 것입니다.
반품
GotoExpression Break와 Kind 같고, 속성이 Target 설정target되고, 속성이 Type .로 설정된 Atype입니다.
적용 대상
Break(LabelTarget, Expression, Type)
지정된 형식을 GotoExpression 사용하여 break 문을 나타내는 형식을 만듭니다. 점프 시 레이블에 전달되는 값을 지정할 수 있습니다.
public:
static System::Linq::Expressions::GotoExpression ^ Break(System::Linq::Expressions::LabelTarget ^ target, System::Linq::Expressions::Expression ^ value, Type ^ type);
public static System.Linq.Expressions.GotoExpression Break(System.Linq.Expressions.LabelTarget target, System.Linq.Expressions.Expression value, Type type);
static member Break : System.Linq.Expressions.LabelTarget * System.Linq.Expressions.Expression * Type -> System.Linq.Expressions.GotoExpression
Public Shared Function Break (target As LabelTarget, value As Expression, type As Type) As GotoExpression
매개 변수
- target
- LabelTarget
LabelTarget 점프 GotoExpression 할 것입니다.
- value
- Expression
점프 시 연결된 레이블에 전달될 값입니다.
반품
GotoExpression Break와 같고Kind, 속성이 Target 설정되고target, Type 속성이 설정type되고value, 점프 시 대상 레이블에 전달됩니다.