Skip to content

IServiceLocator.GetServices() method

Defined in

Type: IServiceLocator Namespace: Splat Assembly: Splat.Core.dll

Applies to

net11.0, net10.0, net47, net471, net472, net48, net481

Overloads

  1. IEnumerable<T> GetServices<T>()

  2. IEnumerable<T> GetServices<T>(string contract)

1. Overload

IEnumerable<T> GetServices<T>()

Summary: Gets all registered service instances of the specified type.

Type parameters

NameDescription
TThe type of service to retrieve.

Returns: IEnumerable (opens in a new tab) -- An enumerable collection of service instances of type T. The collection is empty if no services of the specified type are registered.

2. Overload

IEnumerable<T> GetServices<T>(string contract)

Summary: Gets all registered service instances of the specified type that match the given contract name.

Type parameters

NameDescription
TThe type of service to retrieve.

Parameters

NameTypeDescription
contractstring (opens in a new tab)The contract name used to filter the services. Only services registered with this contract will be returned. Cannot be null.

Returns: IEnumerable (opens in a new tab) -- An enumerable collection of service instances of type T that match the specified contract. The collection is empty if no matching services are found.