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

IServiceProviderIsService

public interface IServiceProviderIsService
Provides methods to determine if the specified type is available from the IServiceProvider.
using System; using System.Runtime.CompilerServices; namespace Microsoft.Extensions.DependencyInjection { [System.Runtime.CompilerServices.NullableContext(1)] public interface IServiceProviderIsService { bool IsService(Type serviceType); } }