This documentation is archived and is not being maintained.

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

Supported in: 4, 3.5, 3.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.