WorkflowRuntime.GetLoadedWorkflows 方法

定义

获取一个集合,该集合包含当前加载到内存的所有工作流实例。

public:
 System::Collections::ObjectModel::ReadOnlyCollection<System::Workflow::Runtime::WorkflowInstance ^> ^ GetLoadedWorkflows();
public System.Collections.ObjectModel.ReadOnlyCollection<System.Workflow.Runtime.WorkflowInstance> GetLoadedWorkflows ();
member this.GetLoadedWorkflows : unit -> System.Collections.ObjectModel.ReadOnlyCollection<System.Workflow.Runtime.WorkflowInstance>
Public Function GetLoadedWorkflows () As ReadOnlyCollection(Of WorkflowInstance)

返回

ReadOnlyCollection<WorkflowInstance>

内存中当前加载的每个工作流实例的 WorkflowInstance 对象。

例外

示例

下面的示例演示如何从 WorkflowRuntime 对象中检索已加载工作流的集合。

// Create a new workflow runtime
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
// Start the runtime
workflowRuntime.StartRuntime();
// Create a collection of workflow instances
ReadOnlyCollection<WorkflowInstance> workflows;
// Populate the collection of workflow instances
workflows = workflowRuntime.GetLoadedWorkflows();
' Create a new workflow runtime
Dim workflowRuntime As New WorkflowRuntime()
' Start the runtime
workflowRuntime.StartRuntime()
' Create a collection of workflow instances
Dim workflows As ReadOnlyCollection(Of WorkflowInstance)
' Populate the collection of workflow instances
workflows = workflowRuntime.GetLoadedWorkflows()

注解

请注意,与 GetWorkflow 不同,在运行时未启动的情况下,此方法不会引发 InvalidOperationException

适用于