Прочетете на английски Редактиране

Споделяне чрез


WorkflowRuntime.GetAllServices Method

Definition

Overloads

GetAllServices(Type)

Retrieves all the services that are added to the workflow run-time engine that implement or derive from the specified Type.

GetAllServices<T>()

Retrieves all the services that are added to the workflow run-time engine that implement or derive from the specified generic type.

GetAllServices(Type)

Retrieves all the services that are added to the workflow run-time engine that implement or derive from the specified Type.

C#
public System.Collections.ObjectModel.ReadOnlyCollection<object> GetAllServices(Type serviceType);

Parameters

serviceType
Type

The Type that services must implement to be returned.

Returns

Services that implement or derive from the specified Type.

Exceptions

serviceType is a null reference (Nothing in Visual Basic).

Examples

The following example demonstrates how to retrieve all services of a given type from a WorkflowRuntime object.

C#
// 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);

Remarks

An empty ReadOnlyCollection<T> indicates that no services that implement or derive from the specified Type have been added to the workflow run-time engine.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

GetAllServices<T>()

Retrieves all the services that are added to the workflow run-time engine that implement or derive from the specified generic type.

C#
public System.Collections.ObjectModel.ReadOnlyCollection<T> GetAllServices<T>();

Type Parameters

T

The service type.

Returns

Services that implement or derive from the specified generic type.

Exceptions

Examples

The following example demonstrates how to retrieve all services of a given type from a WorkflowRuntime object.

C#
// 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>();

Remarks

An empty ReadOnlyCollection<T> indicates that no services have been added to the workflow run-time engine that implement or derive from the specified generic type.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1