共用方式為


TerminateActivity 建構函式

定義

多載

TerminateActivity()

初始化 TerminateActivity 類別的新執行個體。

TerminateActivity(String)

使用活動的名稱,初始化 TerminateActivity 類別的新執行個體。

TerminateActivity()

初始化 TerminateActivity 類別的新執行個體。

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

範例

這個範例說明使用 TerminateActivity 的建構函式,此型別內的其他內容已於他處討論。

這個程式碼範例是 SuspendAndTerminateWorkflow.Designer.cs 檔案中<暫止與結束 SDK>範例的一部分。 如需詳細資訊,請參閱 使用暫停和終止

[System.Diagnostics.DebuggerNonUserCode()]
private void InitializeComponent()
{
    this.CanModifyActivities = true;
    this.suspend = new System.Workflow.ComponentModel.SuspendActivity();
    this.consoleMessage = new System.Workflow.Activities.CodeActivity();
    this.terminate = new System.Workflow.ComponentModel.TerminateActivity();
    //
    // suspend
    //
    this.suspend.Error = null;
    this.suspend.Name = "suspend";
    //
    // ConsoleMessage
    //
    this.consoleMessage.Name = "consoleMessage";
    this.consoleMessage.ExecuteCode += new System.EventHandler(this.OnConsoleMessage);
    //
    // terminate
    //
    this.terminate.Error = null;
    this.terminate.Name = "terminate";
    //
    // SuspendAndTerminateWorkflow
    //
    this.Activities.Add(this.suspend);
    this.Activities.Add(this.consoleMessage);
    this.Activities.Add(this.terminate);
    this.Name = "SuspendAndTerminateWorkflow";
    this.CanModifyActivities = false;
}
<System.Diagnostics.DebuggerNonUserCode()> _
                            Private Sub InitializeComponent()

    Me.CanModifyActivities = True
    Me.suspend = New System.Workflow.ComponentModel.SuspendActivity()
    Me.consoleMessage = New System.Workflow.Activities.CodeActivity()
    Me.terminate = New System.Workflow.ComponentModel.TerminateActivity()
    ' 
    ' suspend
    ' 
    Me.suspend.Error = Nothing
    Me.suspend.Name = "suspend"
    ' 
    ' ConsoleMessage
    ' 
    Me.consoleMessage.Name = "consoleMessage"
    AddHandler Me.consoleMessage.ExecuteCode, AddressOf Me.OnConsoleMessage
    ' 
    ' terminate
    ' 
    Me.terminate.Error = Nothing
    Me.terminate.Name = "terminate"
    ' 
    ' SuspendAndTerminateWorkflow
    ' 
    Me.Activities.Add(Me.suspend)
    Me.Activities.Add(Me.consoleMessage)
    Me.Activities.Add(Me.terminate)
    Me.Name = "SuspendAndTerminateWorkflow"
    Me.CanModifyActivities = False
End Sub

備註

下表所顯示的是 TerminateActivity 類別之執行個體的初始屬性值。

屬性
Error null (在 Visual Basic 中為 Nothing)。

適用於

TerminateActivity(String)

使用活動的名稱,初始化 TerminateActivity 類別的新執行個體。

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

參數

name
String

使用者定義的活動名稱。

適用於