Microsoft.Extensions.DependencyInjection.Abstractions by Microsoft

<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.0.0-preview8.19405.4" />

 ServiceProviderServiceExtensions

public static class ServiceProviderServiceExtensions
Extension methods for getting services from an IServiceProvider.
public static IServiceScope CreateScope(this IServiceProvider provider)

Creates a new IServiceScope that can be used to resolve scoped services.

public static object GetRequiredService(this IServiceProvider provider, Type serviceType)

Get service of type serviceType from the IServiceProvider.

public static T GetRequiredService<T>(this IServiceProvider provider)

Get service of type T from the IServiceProvider.

public static T GetService<T>(this IServiceProvider provider)

Get service of type T from the IServiceProvider.

public static IEnumerable<T> GetServices<T>(this IServiceProvider provider)

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

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

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