FlowSwitch<T>.Cases 屬性

定義

取得由 FlowSwitch<T> 項目所處理之案例的字典。Gets a dictionary of cases to be processed by the FlowSwitch<T> element.

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

屬性值

IDictionary<T,FlowNode>

案例的集合。The collection of cases.

範例

下列程式碼範例將示範如何設定 FlowSwitch<T> 節點的 Cases 屬性。The following code sample demonstrates setting the Cases property of a FlowSwitch<T> node. 此範例來自 使用 TryCatch 範例的流程圖活動中的錯誤處理This example is from the Fault Handling in a Flowchart Activity Using TryCatch sample.

FlowSwitch<string> promoCodeSwitch = new FlowSwitch<string>
{
    Expression = promo,
    Cases =
    {
       { "Single", singleStep },
       { "MNK", mnkStep },
       { "MWK", mwkStep }
    },
    Default = discountDefault
};

備註

字典中的每個項目都是由在 FlowSwitch<T> 中所指定之泛型型別的物件,以及要執行的對應 FlowNode 所構成。Each element in the dictionary consists of an object of the generic type specified in FlowSwitch<T> and a corresponding FlowNode to execute.

適用於