共用方式為


WorkflowRuntime.GetAllServices 方法

定義

多載

GetAllServices(Type)

擷取已加入工作流程執行階段引擎的所有服務,這些服務實作或衍生自指定的 Type

GetAllServices<T>()

擷取已加入工作流程執行階段引擎的所有服務,這些服務實作或衍生自指定的泛型型別。

GetAllServices(Type)

擷取已加入工作流程執行階段引擎的所有服務,這些服務實作或衍生自指定的 Type

public:
 System::Collections::ObjectModel::ReadOnlyCollection<System::Object ^> ^ GetAllServices(Type ^ serviceType);
public System.Collections.ObjectModel.ReadOnlyCollection<object> GetAllServices (Type serviceType);
member this.GetAllServices : Type -> System.Collections.ObjectModel.ReadOnlyCollection<obj>
Public Function GetAllServices (serviceType As Type) As ReadOnlyCollection(Of Object)

參數

serviceType
Type

服務必須實作才能傳回的 Type

傳回

ReadOnlyCollection<Object>

實作或衍生自指定 Type 的服務。

例外狀況

serviceType 為 null 參考 (在 Visual Basic 中為 Nothing)。

範例

下列範例示範如何從 WorkflowRuntime 物件擷取指定類型的所有服務。

// Create a new workflow runtime
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
// Obtain the type of the TrackingService abstract class
Type serviceType = typeof(TrackingService);
// Create a services collection
ReadOnlyCollection<object> services;
// Fetch a collection of all services that match the given type
services = workflowRuntime.GetAllServices(serviceType);
' Create a new workflow runtime
Dim workflowRuntime As New WorkflowRuntime()
' Obtain the type of the TrackingService abstract class
Dim serviceType As Type = GetType(TrackingService)
' Create a services collection
Dim services As ReadOnlyCollection(Of Object)
' Fetch a collection of all services that match the given type
services = workflowRuntime.GetAllServices(serviceType)

備註

空的 ReadOnlyCollection<T> 表示沒有任何實作或衍生自指定之 Type 的服務加入工作流程執行階段引擎中。

適用於

GetAllServices<T>()

擷取已加入工作流程執行階段引擎的所有服務,這些服務實作或衍生自指定的泛型型別。

public:
generic <typename T>
 System::Collections::ObjectModel::ReadOnlyCollection<T> ^ GetAllServices();
public System.Collections.ObjectModel.ReadOnlyCollection<T> GetAllServices<T> ();
member this.GetAllServices : unit -> System.Collections.ObjectModel.ReadOnlyCollection<'T>
Public Function GetAllServices(Of T) () As ReadOnlyCollection(Of T)

類型參數

T

服務類型。

傳回

ReadOnlyCollection<T>

實作或衍生自指定泛型型別的服務。

例外狀況

範例

下列範例示範如何從 WorkflowRuntime 物件擷取指定類型的所有服務。

// Create a new workflow runtime
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
// Obtain the type of the TrackingService abstract class
Type serviceType = typeof(TrackingService);
// Create a services collection
ReadOnlyCollection<TrackingService> services;
// Fetch a collection of all services that match the given type
services = workflowRuntime.GetAllServices<TrackingService>();
' Create a new workflow runtime
Dim workflowRuntime As New WorkflowRuntime()
' Obtain the type of the TrackingService abstract class
Dim serviceType As Type = GetType(TrackingService)
' Create a services collection
Dim services As ReadOnlyCollection(Of TrackingService)
' Fetch a collection of all services that match the given type
services = workflowRuntime.GetAllServices(Of TrackingService)()

備註

空的 ReadOnlyCollection<T> 表示沒有任何實作或衍生自指定之泛型型別的服務加入工作流程執行階段引擎中。

適用於