Skip to content

IServiceLocator.GetServices() method

Defined in

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

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481, net471

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 -- 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
contractstringThe contract name used to filter the services. Only services registered with this contract will be returned. Cannot be null.

Returns: IEnumerable -- An enumerable collection of service instances of type T that match the specified contract. The collection is empty if no matching services are found.