ServiceHelperLocateService Method (Type, Object) |
Convenience method for implementing IServiceProvider objects.
If candidate is an instance of serviceType,
returns candidate, otherwise returns .
Namespace:
AGI.Foundation.Infrastructure
Assembly:
AGI.Foundation.Core (in AGI.Foundation.Core.dll) Version: 25.2.423.0 (25.2.423.0)
Syntaxpublic static Object LocateService(
Type serviceType,
Object candidate
)
Public Shared Function LocateService (
serviceType As Type,
candidate As Object
) As Object
public:
static Object^ LocateService(
Type^ serviceType,
Object^ candidate
)
static member LocateService :
serviceType : Type *
candidate : Object -> Object
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.
Return Value
Type:
Objectcandidate if it is of type
serviceType; otherwise
.
Exceptions| Exception | Condition |
|---|
| ArgumentNullException |
Thrown when serviceType or candidate is .
|
See Also