Expression.Goto Expression.Goto Expression.Goto Expression.Goto Method

定義

go to ステートメントを表す GotoExpression を作成します。Creates a GotoExpression representing a "go to" statement.

オーバーロード

Goto(LabelTarget, Expression, Type) Goto(LabelTarget, Expression, Type) Goto(LabelTarget, Expression, Type)

型を指定して、go to ステートメントを表す GotoExpression を作成します。Creates a GotoExpression representing a "go to" statement with the specified type. ジャンプ時にラベルに渡す値を指定できます。The value passed to the label upon jumping can be specified.

Goto(LabelTarget, Type) Goto(LabelTarget, Type) Goto(LabelTarget, Type)

型を指定して、go to ステートメントを表す GotoExpression を作成します。Creates a GotoExpression representing a "go to" statement with the specified type.

Goto(LabelTarget) Goto(LabelTarget) Goto(LabelTarget) Goto(LabelTarget)

go to ステートメントを表す GotoExpression を作成します。Creates a GotoExpression representing a "go to" statement.

Goto(LabelTarget, Expression) Goto(LabelTarget, Expression) Goto(LabelTarget, Expression) Goto(LabelTarget, Expression)

go to ステートメントを表す GotoExpression を作成します。Creates a GotoExpression representing a "go to" statement. ジャンプ時にラベルに渡す値を指定できます。The value passed to the label upon jumping can be specified.

Goto(LabelTarget, Expression, Type) Goto(LabelTarget, Expression, Type) Goto(LabelTarget, Expression, Type)

型を指定して、go to ステートメントを表す GotoExpression を作成します。Creates a GotoExpression representing a "go to" statement with the specified type. ジャンプ時にラベルに渡す値を指定できます。The value passed to the label upon jumping can be specified.

public:
 static System::Linq::Expressions::GotoExpression ^ Goto(System::Linq::Expressions::LabelTarget ^ target, System::Linq::Expressions::Expression ^ value, Type ^ type);
public static System.Linq.Expressions.GotoExpression Goto (System.Linq.Expressions.LabelTarget target, System.Linq.Expressions.Expression value, Type type);
static member Goto : System.Linq.Expressions.LabelTarget * System.Linq.Expressions.Expression * Type -> System.Linq.Expressions.GotoExpression

パラメーター

target
LabelTarget LabelTarget LabelTarget LabelTarget

LabelTarget のジャンプ先の GotoExpressionThe LabelTarget that the GotoExpression will jump to.

value
Expression Expression Expression Expression

ジャンプ時に関連付けられているラベルに渡される値。The value that will be passed to the associated label upon jumping.

type
Type Type Type Type

Type プロパティを等しく設定する TypeAn Type to set the Type property equal to.

戻り値

Goto と等しい GotoExpressionKind に設定された Target プロパティ、target に設定された Type プロパティ、およびジャンプ時にジャンプ先のラベルに渡される type を含む valueA GotoExpression with Kind equal to Goto, the Target property set to target, the Type property set to type, and value to be passed to the target label upon jumping.

Goto(LabelTarget, Type) Goto(LabelTarget, Type) Goto(LabelTarget, Type)

型を指定して、go to ステートメントを表す GotoExpression を作成します。Creates a GotoExpression representing a "go to" statement with the specified type.

public:
 static System::Linq::Expressions::GotoExpression ^ Goto(System::Linq::Expressions::LabelTarget ^ target, Type ^ type);
public static System.Linq.Expressions.GotoExpression Goto (System.Linq.Expressions.LabelTarget target, Type type);
static member Goto : System.Linq.Expressions.LabelTarget * Type -> System.Linq.Expressions.GotoExpression

パラメーター

target
LabelTarget LabelTarget LabelTarget LabelTarget

LabelTarget のジャンプ先の GotoExpressionThe LabelTarget that the GotoExpression will jump to.

type
Type Type Type Type

Type プロパティを等しく設定する TypeAn Type to set the Type property equal to.

戻り値

Goto と等しい GotoExpression、指定された値に設定された Kind プロパティ、Target に設定された Type プロパティ、およびジャンプ時にジャンプ先のラベルに渡される null 値を含む typeA GotoExpression with Kind equal to Goto, the Target property set to the specified value, the Type property set to type, and a null value to be passed to the target label upon jumping.

Goto(LabelTarget) Goto(LabelTarget) Goto(LabelTarget) Goto(LabelTarget)

go to ステートメントを表す GotoExpression を作成します。Creates a GotoExpression representing a "go to" statement.

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

パラメーター

target
LabelTarget LabelTarget LabelTarget LabelTarget

LabelTarget のジャンプ先の GotoExpressionThe LabelTarget that the GotoExpression will jump to.

戻り値

Goto と等しい GotoExpression、指定された値に設定された Kind プロパティ、およびジャンプ時にジャンプ先のラベルに渡される null 値を含む TargetA GotoExpression with Kind equal to Goto, the Target property set to the specified value, and a null value to be passed to the target label upon jumping.

次の例を含む式を作成する方法を示します、GotoExpressionオブジェクト。The following example demonstrates how to create an expression that contains a GotoExpression object.

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

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

// This block contains a GotoExpression.
// 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("GoTo")),
        Expression.Goto(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:
//
// GoTo

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

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

' This block contains a GotoExpression.
' 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("GoTo")),
          Expression.Goto(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:
'
' GoTo

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

Goto(LabelTarget, Expression) Goto(LabelTarget, Expression) Goto(LabelTarget, Expression) Goto(LabelTarget, Expression)

go to ステートメントを表す GotoExpression を作成します。Creates a GotoExpression representing a "go to" statement. ジャンプ時にラベルに渡す値を指定できます。The value passed to the label upon jumping can be specified.

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

パラメーター

target
LabelTarget LabelTarget LabelTarget LabelTarget

LabelTarget のジャンプ先の GotoExpressionThe LabelTarget that the GotoExpression will jump to.

value
Expression Expression Expression Expression

ジャンプ時に関連付けられているラベルに渡される値。The value that will be passed to the associated label upon jumping.

戻り値

Goto と等しい GotoExpressionKind に設定された Target プロパティ、およびジャンプ時にジャンプ先のラベルに渡される target を含む valueA GotoExpression with Kind equal to Goto, the Target property set to target, and value to be passed to the target label upon jumping.

適用対象