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)

속성 값

실행 경로입니다.

예제

다음 코드 샘플에서는 활동의 Cases 속성을 설정하는 방법을 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" } }
    }
}

설명

작업이 실행될 때 실행되는 사례는 키가 속성과 일치하는 Expression 첫 번째 사례입니다.

적용 대상