共用方式為


ActivityCollection.Add(Activity) 方法

定義

Activity 新增至 ICollection

public:
 void Add(System::Workflow::ComponentModel::Activity ^ item);
public void Add (System.Workflow.ComponentModel.Activity item);
override this.Add : System.Workflow.ComponentModel.Activity -> unit
Public Sub Add (item As Activity)

參數

item
Activity

要加入至 ActivityICollection

實作

範例

下列範例顯示存取 ActivityCollection,它是包含所有子活動的複合活動類別的成員。 這個範例說明 Add 的使用方式。 這個程式碼範例是 ThrowWorkflow.cs 檔案中<擲回 SDK>範例的一部分。 如需詳細資訊,請參閱 使用 ThrowActivity 活動

this.CanModifyActivities = true;
System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
this.throwActivity1 = new System.Workflow.ComponentModel.ThrowActivity();
activitybind1.Name = "ThrowWorkflow";
activitybind1.Path = "ThrownException";
//
// throwActivity1
//
this.throwActivity1.Name = "throwActivity1";
this.throwActivity1.SetBinding(System.Workflow.ComponentModel.ThrowActivity.FaultProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
//
// ThrowWorkflow
//
this.Activities.Add(this.throwActivity1);
this.Name = "ThrowWorkflow";
this.CanModifyActivities = false;
Me.CanModifyActivities = True
Dim activitybind1 As New System.Workflow.ComponentModel.ActivityBind()
Me.throwActivity1 = New System.Workflow.ComponentModel.ThrowActivity()
activitybind1.Name = "ThrowWorkflow"
activitybind1.Path = "ThrownException"
' 
' throwActivity1
' 
Me.throwActivity1.Name = "throwActivity1"
Me.throwActivity1.SetBinding(System.Workflow.ComponentModel.ThrowActivity.FaultProperty, activitybind1)
' 
' ThrowWorkflow
' 
Me.Activities.Add(Me.throwActivity1)
Me.Name = "ThrowWorkflow"
Me.CanModifyActivities = False

適用於