<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0-preview.5.25277.114" />

IServiceProviderIsKeyedService

Provides methods to determine if the specified type with the specified service key is available from the IServiceProvider.
using System; using System.Runtime.CompilerServices; namespace Microsoft.Extensions.DependencyInjection { public interface IServiceProviderIsKeyedService : IServiceProviderIsService { [System.Runtime.CompilerServices.NullableContext(1)] bool IsKeyedService(Type serviceType, [System.Runtime.CompilerServices.Nullable(2)] object serviceKey); } }