WorkflowInstance.GetWorkflowDefinition Method

Definition

Retrieves the root activity for this workflow instance.

C#
public System.Workflow.ComponentModel.Activity GetWorkflowDefinition();

Returns

An Activity object.

Examples

The following example demonstrates retrieving the workflow definition from a workflow instance. This example is from the Ordering State Machine SDK sample, from the Mainform.cs file. For more information, see the Ordering State Machine Sample.

C#
// Get a reference to the root activity for the workflow
Activity root = instance.GetWorkflowDefinition();

Remarks

You can use the root activity to navigate the activity hierarchy of the workflow.

This method is not thread safe, so the host should synchronize its calls to this method.

Applies to

Product Versions
.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