FlowSwitch<T>.Expression 屬性

定義

要針對 Cases 之集合評估的運算式。The expression to evaluate against the collection of Cases.

public:
 property System::Activities::Activity<T> ^ Expression { System::Activities::Activity<T> ^ get(); void set(System::Activities::Activity<T> ^ value); };
public System.Activities.Activity<T> Expression { get; set; }
member this.Expression : System.Activities.Activity<'T> with get, set
Public Property Expression As Activity(Of T)

屬性值

Activity<T>

要評估的運算式。The expression to evaluate.

範例

下列程式碼範例將示範如何設定 FlowSwitch<T> 節點的 Expression 屬性。The following code sample demonstrates setting the Expression 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
};

適用於