Expression.Return 메서드

정의

GotoExpression 반환 문을 나타내는 문을 만듭니다.

오버로드

Name Description
Return(LabelTarget)

GotoExpression 반환 문을 나타내는 문을 만듭니다.

Return(LabelTarget, Expression)

GotoExpression 반환 문을 나타내는 문을 만듭니다. 점프 시 레이블에 전달되는 값을 지정할 수 있습니다.

Return(LabelTarget, Type)

지정된 형식을 GotoExpression 사용하여 return 문을 나타내는 형식을 만듭니다.

Return(LabelTarget, Expression, Type)

지정된 형식을 GotoExpression 사용하여 return 문을 나타내는 형식을 만듭니다. 점프 시 레이블에 전달되는 값을 지정할 수 있습니다.

Return(LabelTarget)

GotoExpression 반환 문을 나타내는 문을 만듭니다.

public:
 static System::Linq::Expressions::GotoExpression ^ Return(System::Linq::Expressions::LabelTarget ^ target);
public static System.Linq.Expressions.GotoExpression Return(System.Linq.Expressions.LabelTarget target);
static member Return : System.Linq.Expressions.LabelTarget -> System.Linq.Expressions.GotoExpression
Public Shared Function Return (target As LabelTarget) As GotoExpression

매개 변수

target
LabelTarget

LabelTarget 점프 GotoExpression 할 것입니다.

반품

GotoExpression Return과 같고Kind, 속성이 Target 설정target되고, 점프 시 대상 레이블에 전달할 null 값이 있는 A입니다.

적용 대상

Return(LabelTarget, Expression)

GotoExpression 반환 문을 나타내는 문을 만듭니다. 점프 시 레이블에 전달되는 값을 지정할 수 있습니다.

public:
 static System::Linq::Expressions::GotoExpression ^ Return(System::Linq::Expressions::LabelTarget ^ target, System::Linq::Expressions::Expression ^ value);
public static System.Linq.Expressions.GotoExpression Return(System.Linq.Expressions.LabelTarget target, System.Linq.Expressions.Expression value);
static member Return : System.Linq.Expressions.LabelTarget * System.Linq.Expressions.Expression -> System.Linq.Expressions.GotoExpression
Public Shared Function Return (target As LabelTarget, value As Expression) As GotoExpression

매개 변수

target
LabelTarget

LabelTarget 점프 GotoExpression 할 것입니다.

value
Expression

점프 시 연결된 레이블에 전달될 값입니다.

반품

Kind 이동 시 대상 레이블에 전달될 속성이 Continue Target 와 같고 value 속성이 설정된 targetA GotoExpression 입니다.

예제

다음 예제에서는 메서드를 포함 하는 식을 만드는 방법을 보여 줍니다 Return .

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

// A label expression of the void type that is the target for Expression.Return().
LabelTarget returnTarget = Expression.Label();

// This block contains a GotoExpression that represents a return statement with no value.
// It transfers execution to a label expression that is initialized with the same LabelTarget as the GotoExpression.
// The types of the GotoExpression, label expression, and LabelTarget must match.
BlockExpression blockExpr =
    Expression.Block(
        Expression.Call(typeof(Console).GetMethod("WriteLine", new Type[] { typeof(string) }), Expression.Constant("Return")),
        Expression.Return(returnTarget),
        Expression.Call(typeof(Console).GetMethod("WriteLine", new Type[] { typeof(string) }), Expression.Constant("Other Work")),
        Expression.Label(returnTarget)
    );

// The following statement first creates an expression tree,
// then compiles it, and then runs it.
Expression.Lambda<Action>(blockExpr).Compile()();

// This code example produces the following output:
//
// Return

// "Other Work" is not printed because
// the Return expression transfers execution from Expression.Return(returnTarget)
// to Expression.Label(returnTarget).
' Add the following directive to the file:
' Imports System.Linq.Expressions  

' A label expression of the void type that is the target for Expression.Return().
Dim returnTarget As LabelTarget = Expression.Label()

' This block contains a GotoExpression that represents a return statement with no value.
' It transfers execution to a label expression that is initialized with the same LabelTarget as the GotoExpression.
' The types of the GotoExpression, label expression, and LabelTarget must match.
Dim blockExpr As BlockExpression =
      Expression.Block(
          Expression.Call(GetType(Console).GetMethod("WriteLine", New Type() {GetType(String)}), Expression.Constant("Return")),
          Expression.Return(returnTarget),
          Expression.Call(GetType(Console).GetMethod("WriteLine", New Type() {GetType(String)}), Expression.Constant("Other Work")),
          Expression.Label(returnTarget)
      )

' The following statement first creates an expression tree,
' then compiles it, and then runs it.
Expression.Lambda(Of Action)(blockExpr).Compile()()

' This code example produces the following output:
'
' Return

' "Other Work" is not printed because 
' the Return expression transfers execution from Return(returnTarget)
' to Expression.Label(returnTarget).

적용 대상

Return(LabelTarget, Type)

지정된 형식을 GotoExpression 사용하여 return 문을 나타내는 형식을 만듭니다.

public:
 static System::Linq::Expressions::GotoExpression ^ Return(System::Linq::Expressions::LabelTarget ^ target, Type ^ type);
public static System.Linq.Expressions.GotoExpression Return(System.Linq.Expressions.LabelTarget target, Type type);
static member Return : System.Linq.Expressions.LabelTarget * Type -> System.Linq.Expressions.GotoExpression
Public Shared Function Return (target As LabelTarget, type As Type) As GotoExpression

매개 변수

target
LabelTarget

LabelTarget 점프 GotoExpression 할 것입니다.

type
Type

Type 속성을 같게 Type 설정하는 값입니다.

반품

GotoExpression Return과 같고Kind, 속성이 Target 설정target되고, Type 속성이 설정type되고, 점프 시 대상 레이블에 전달될 null 값이 있는 A입니다.

적용 대상

Return(LabelTarget, Expression, Type)

지정된 형식을 GotoExpression 사용하여 return 문을 나타내는 형식을 만듭니다. 점프 시 레이블에 전달되는 값을 지정할 수 있습니다.

public:
 static System::Linq::Expressions::GotoExpression ^ Return(System::Linq::Expressions::LabelTarget ^ target, System::Linq::Expressions::Expression ^ value, Type ^ type);
public static System.Linq.Expressions.GotoExpression Return(System.Linq.Expressions.LabelTarget target, System.Linq.Expressions.Expression value, Type type);
static member Return : System.Linq.Expressions.LabelTarget * System.Linq.Expressions.Expression * Type -> System.Linq.Expressions.GotoExpression
Public Shared Function Return (target As LabelTarget, value As Expression, type As Type) As GotoExpression

매개 변수

target
LabelTarget

LabelTarget 점프 GotoExpression 할 것입니다.

value
Expression

점프 시 연결된 레이블에 전달될 값입니다.

type
Type

Type 속성을 같게 Type 설정하는 값입니다.

반품

Continue GotoExpression 와 같고 Kind , 속성이 Target 설정되고 target, 속성이 Type 설정 type되고 value , 점프 시 대상 레이블에 전달됩니다.

적용 대상