Expression.Continue Expression.Continue Expression.Continue Expression.Continue Method

定義

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

オーバーロード

Continue(LabelTarget) Continue(LabelTarget) Continue(LabelTarget) Continue(LabelTarget)

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

Continue(LabelTarget, Type) Continue(LabelTarget, Type) Continue(LabelTarget, Type)

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

Continue(LabelTarget) Continue(LabelTarget) Continue(LabelTarget) Continue(LabelTarget)

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

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

パラメーター

target
LabelTarget LabelTarget LabelTarget LabelTarget

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

戻り値

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

次の例では、使用する、ループの式を作成する方法、Continueメソッド。The following example demonstrates how to create a loop expression that uses the Continue method.

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

// A label that is used by a break statement and a loop. 
LabelTarget breakLabel = Expression.Label();

// A label that is used by the Continue statement and the loop it refers to.
LabelTarget continueLabel = Expression.Label();

// This expression represents a Continue statement.
Expression continueExpr = Expression.Continue(continueLabel);

// A variable that triggers the exit from the loop.
ParameterExpression count = Expression.Parameter(typeof(int));

// A loop statement.
Expression loopExpr = Expression.Loop(
    Expression.Block(
        Expression.IfThen(
            Expression.GreaterThan(count, Expression.Constant(3)),
            Expression.Break(breakLabel)
        ),
        Expression.PreIncrementAssign(count),
        Expression.Call(
                    null,
                    typeof(Console).GetMethod("WriteLine", new Type[] { typeof(String) }),
                    Expression.Constant("Loop")
                ),
        continueExpr,
        Expression.PreDecrementAssign(count)
    ),
    breakLabel,
    continueLabel
);

// The following statement first creates an expression tree,
// then compiles it, and then runs it.
// Without the Continue statement, the loop would go on forever.
Expression.Lambda<Action<int>>(loopExpr, count).Compile()(1);

// This code example produces the following output:
//
// Loop
// Loop
// Loop
' Add the following directive to your file:
' Imports System.Linq.Expressions  

' A label that is used by a break statement and a loop. 
Dim breakLabel As LabelTarget = Expression.Label()

' A label that is used by the Continue statement and the loop it refers to.
Dim continueLabel As LabelTarget = Expression.Label()

' This expression represents a Continue statement.
Dim continueExpr As Expression = Expression.Continue(continueLabel)

' A variable that triggers the exit from the loop.
Dim count As ParameterExpression = Expression.Parameter(GetType(Integer))

' A loop statement.
Dim loopExpr As Expression = Expression.Loop(
       Expression.Block(
           Expression.IfThen(
               Expression.GreaterThan(count, Expression.Constant(3)),
               Expression.Break(breakLabel)
           ),
           Expression.PreIncrementAssign(count),
           Expression.Call(
                       Nothing,
                       GetType(Console).GetMethod("WriteLine", New Type() {GetType(String)}),
                       Expression.Constant("Loop")
                   ),
           continueExpr,
           Expression.PreDecrementAssign(count)
       ),
       breakLabel,
       continueLabel
   )

' The following statement first creates an expression tree,
' then compiles it, and then runs it.
' Without the Continue statement, the loop would go on forever.
Expression.Lambda(Of Action(Of Integer))(loopExpr, count).Compile()(1)

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

Continue(LabelTarget, Type) Continue(LabelTarget, Type) Continue(LabelTarget, Type)

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

public:
 static System::Linq::Expressions::GotoExpression ^ Continue(System::Linq::Expressions::LabelTarget ^ target, Type ^ type);
public static System.Linq.Expressions.GotoExpression Continue (System.Linq.Expressions.LabelTarget target, Type type);
static member Continue : 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.

戻り値

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

適用対象