WorkflowRuntime.GetAllServices Method (Type)


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

Namespace:   System.Workflow.Runtime
Assembly:  System.Workflow.Runtime (in System.Workflow.Runtime.dll)

public ReadOnlyCollection<object> GetAllServices(
	Type serviceType


Type: System.Type

The Type that services must implement to be returned.

Return Value

Type: System.Collections.ObjectModel.ReadOnlyCollection<Object>

Services that implement or derive from the specified Type.

Exception Condition

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


The WorkflowRuntime is disposed.

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.

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

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

.NET Framework
Available since 3.0
Return to top