Microsoft.Extensions.DependencyInjection.Abstractions by Microsoft

<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />

 ServiceProviderKeyedServiceExtensions

Extension methods for getting services from an IServiceProvider.
public static T GetKeyedService<T>(this IServiceProvider provider, object serviceKey)

Get service of type T from the IServiceProvider.

public static IEnumerable<T> GetKeyedServices<T>(this IServiceProvider provider, object serviceKey)

Get an enumeration of services of type T from the IServiceProvider.

public static IEnumerable<object> GetKeyedServices(this IServiceProvider provider, Type serviceType, object serviceKey)

Get an enumeration of services of type serviceType from the IServiceProvider.

public static object GetRequiredKeyedService(this IServiceProvider provider, Type serviceType, object serviceKey)

Get service of type serviceType from the IServiceProvider.

public static T GetRequiredKeyedService<T>(this IServiceProvider provider, object serviceKey)

Get service of type T from the IServiceProvider.