Share via


Switch<T>.Cases プロパティ

定義

実行パスのディクショナリを表します。 各エントリには、キー、および式の結果がキーと一致する場合に実行されるアクティビティが含まれます。

public:
 property System::Collections::Generic::IDictionary<T, System::Activities::Activity ^> ^ Cases { System::Collections::Generic::IDictionary<T, System::Activities::Activity ^> ^ get(); };
public System.Collections.Generic.IDictionary<T,System.Activities.Activity> Cases { get; }
member this.Cases : System.Collections.Generic.IDictionary<'T, System.Activities.Activity>
Public ReadOnly Property Cases As IDictionary(Of T, Activity)

プロパティ値

実行パス。

Switch<T> アクティビティの Cases プロパティを設定するコード サンプルを次に示します。

// check if the number is ok...
new Switch<int>()
{
    DisplayName = "Verify Value from User",
    Expression = ExpressionServices.Convert<int>( env => numberFromUser.Get(env).CompareTo(numberToGuess.Get(env)) ),
    Cases =
    {
        { 0, new Assign<bool>()
            {
                To = new OutArgument<bool>(finished),
                Value = true
            }
        },
        {  1, new WriteLine() { Text = "    Try a lower number number..." } },
        { -1, new WriteLine() { Text = "    Try a higher number" } }
    }
}

注釈

アクティビティ実行時、実行される case は、Expression プロパティとキーが一致する最初の case です。

適用対象