FlowSwitch<T> 類別

定義

允許建立切換建構模型,且每個相符都有一個運算式與一個結果的特定 FlowNodeA specialized FlowNode that allows modeling a switch construct, with one expression and one outcome for each match.

generic <typename T>
public ref class FlowSwitch sealed : System::Activities::Statements::FlowNode
[System.Windows.Markup.ContentProperty("Cases")]
public sealed class FlowSwitch<T> : System.Activities.Statements.FlowNode
[<System.Windows.Markup.ContentProperty("Cases")>]
type FlowSwitch<'T> = class
    inherit FlowNode
Public NotInheritable Class FlowSwitch(Of T)
Inherits FlowNode

類型參數

T

評估案例的運算式型別。The type of the expression to evaluate against cases.

繼承
FlowSwitch<T>
屬性

範例

下列程式碼範例將示範如何建立 FlowSwitch<T> 節點。The following code sample demonstrates creating 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>()

建立 FlowSwitch<T> 類別的新執行個體。Creates a new instance of the FlowSwitch<T> class.

屬性

Cases

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

Default

FlowNode 集合中的項目沒有符合 Cases 的評估結果時,所要執行的 ExpressionThe FlowNode to be executed if no elements in the Cases collection match the result of the evaluation of the Expression.

DisplayName

取得要在活動設計工具中顯示的這個流程參數的名稱。Gets the name of this flow switch to be displayed in the activity designer.

Expression

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

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

適用於