Click or drag to resize

ServiceHelperLocateServiceT Method (Type, Object, T)

Convenience method for implementing IServiceProvider objects. If candidate is an instance of serviceType, returns candidate. Otherwise, checks additional IServiceProvider objects for any that return a non-null result for serviceType. Otherwise, returns .

Namespace:  AGI.Foundation.Infrastructure
Assembly:  AGI.Foundation.Core (in AGI.Foundation.Core.dll) Version: 24.1.418.0 (24.1.418.0)
Syntax
public static Object LocateService<T>(
	Type serviceType,
	Object candidate,
	params T[] additionalServiceProviders
)
where T : IServiceProvider

Parameters

serviceType
Type: SystemType
The type of the service that is requested.
candidate
Type: SystemObject
A candidate object that could be of the requested serviceType.
additionalServiceProviders
Type: T
Additional service providers that will be checked, in order, for the requested service. The first non-null result will be returned.

Type Parameters

T
The type of additional service providers to search.

Return Value

Type: Object
The requested service, or if not found.
Exceptions
ExceptionCondition
ArgumentNullException Thrown when serviceType, candidate, or additionalServiceProviders is .
See Also