Bagikan melalui


Switch<T>.Cases Properti

Definisi

Mewakili kamus jalur eksekusi potensial. Setiap entri berisi kunci dan aktivitas yang dijalankan saat hasil ekspresi cocok dengan kunci.

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)

Nilai Properti

Jalur eksekusi.

Contoh

Sampel kode berikut menunjukkan pengaturan properti Kasus aktivitas Switch<T> .

// 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" } }
    }
}

Keterangan

Ketika aktivitas dijalankan, kasus yang dijalankan adalah kasus pertama yang kuncinya cocok dengan Expression properti .

Berlaku untuk