Прочетете на английски Редактиране

Споделяне чрез


WorkflowInstance.Suspend(String) Method

Definition

Suspends the workflow instance.

C#
public void Suspend(string error);

Parameters

error
String

A description of the reason for suspending the workflow instance.

Exceptions

The workflow runtime engine is not running.

Examples

The following code example demonstrates calling Suspend on a WorkflowInstance object.

C#
// Create a workflow runtime
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
// Create a workflow instance
WorkflowInstance workflowInstance = workflowRuntime.CreateWorkflow(typeof(Workflow1));
// Start the workflow
workflowInstance.Start();
// Suspend the workflow, passing in a message
workflowInstance.Suspend("Workflow manually suspended");

Remarks

The workflow instance is suspended in a synchronous manner. If the workflow instance is already suspended, no action is taken; otherwise, the workflow runtime engine suspends the workflow instance, raises the WorkflowSuspended event and passes reason in a WorkflowSuspendedEventArgs.

Бележка

Suspend does not unload the workflow instance.

Applies to

Продукт Версии
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1