AIAgent.GetService Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| GetService(Type, Object) |
Asks the AIAgent for an object of the specified type |
| GetService<TService>(Object) |
Asks the AIAgent for an object of type |
GetService(Type, Object)
Asks the AIAgent for an object of the specified type serviceType.
public virtual object? GetService(Type serviceType, object? serviceKey = default);
abstract member GetService : Type * obj -> obj
override this.GetService : Type * obj -> obj
Public Overridable Function GetService (serviceType As Type, Optional serviceKey As Object = Nothing) As Object
Parameters
- serviceType
- Type
The type of object being requested.
- serviceKey
- Object
An optional key that can be used to help identify the target service.
Returns
The found object, otherwise null.
Exceptions
serviceType is null.
Remarks
The purpose of this method is to allow for the retrieval of strongly-typed services that might be provided by the AIAgent, including itself or any services it might be wrapping. For example, to access the AIAgentMetadata for the instance, GetService(Type, Object) may be used to request it.
Applies to
GetService<TService>(Object)
Asks the AIAgent for an object of type TService.
public TService? GetService<TService>(object? serviceKey = default);
member this.GetService : obj -> 'Service
Public Function GetService(Of TService) (Optional serviceKey As Object = Nothing) As TService
Type Parameters
- TService
The type of the object to be retrieved.
Parameters
- serviceKey
- Object
An optional key that can be used to help identify the target service.
Returns
The found object, otherwise null.
Remarks
The purpose of this method is to allow for the retrieval of strongly typed services that may be provided by the AIAgent, including itself or any services it might be wrapping.