GetWorkflowDefinition Method

WorkflowInstance.GetWorkflowDefinition Method ()


Retrieves the root activity for this workflow instance.

Namespace:   System.Workflow.Runtime
Assembly:  System.Workflow.Runtime (in System.Workflow.Runtime.dll)

public Activity GetWorkflowDefinition()

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.

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.

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

.NET Framework
Available since 3.0
Return to top
© 2016 Microsoft