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)

傳回

目前載入記憶體中之每個工作流程執行個體的 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

適用於