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

IKeyedServiceProvider

Retrieves services using a key and a type.
using System; using System.Runtime.CompilerServices; namespace Microsoft.Extensions.DependencyInjection { public interface IKeyedServiceProvider : IServiceProvider { [System.Runtime.CompilerServices.NullableContext(2)] object GetKeyedService([System.Runtime.CompilerServices.Nullable(1)] Type serviceType, object serviceKey); [System.Runtime.CompilerServices.NullableContext(1)] object GetRequiredKeyedService(Type serviceType, [System.Runtime.CompilerServices.Nullable(2)] object serviceKey); } }