Activity 构造函数

定义

初始化 Activity 类的新实例。

重载

Activity()

初始化 Activity 类的新实例。

Activity(String)

初始化 Activity 类的新实例,同时初始化 Name

Activity()

初始化 Activity 类的新实例。

public:
 Activity();
public Activity ();
Public Sub New ()

示例

下面的代码演示如何创建活动并将它们作为子级添加到复合活动中。

此代码示例摘自 ThrowWorkFlow.cs 文件中的“引发 SDK”示例。 有关详细信息,请参阅 “引发示例”。

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

适用于

Activity(String)

初始化 Activity 类的新实例,同时初始化 Name

public:
 Activity(System::String ^ name);
public Activity (string name);
new System.Workflow.ComponentModel.Activity : string -> System.Workflow.ComponentModel.Activity
Public Sub New (name As String)

参数

name
String

与此实例关联的名称。 名称必须符合工作流项目中使用的编程语言的变量命名规则,并且在工作流中必须是唯一的名称。

例外

name 为空引用(在 Visual Basic 中为 Nothing)。

适用于