Activity.Name 属性

定义

获取或设置此实例的名称。 此名称必须符合工作流项目中使用的编程语言的变量命名规则。

public:
 property System::String ^ Name { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Browsable(true)]
public string Name { get; set; }
[<System.ComponentModel.Browsable(true)>]
member this.Name : string with get, set
Public Property Name As String

属性值

String

此实例的名称。

属性

示例

以下代码演示如何创建活动并将它们作为子级添加到复合活动,以及如何设置 Name 的值。

此代码示例摘自 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

注解

此项的默认值为空字符串。

此属性是元属性,这意味着它不能在运行时更改。 在运行时创建了属性实例之后,元属性不发生更改,因此该属性必须在设计时设置为文本值。

适用于