ActivityCollection.Add(Activity) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将 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
要添加到 Activity 的 ICollection。
实现
示例
下面的示例演示如何访问 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