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 为空引用(在 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> 表示没有向工作流运行时引擎添加实现或派生自指定泛型类型的服务。

适用于