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

KeyedService

public static class KeyedService
Provides static APIs for use with IKeyedServiceProvider.
using System.Runtime.CompilerServices; namespace Microsoft.Extensions.DependencyInjection { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] public static class KeyedService { private sealed class AnyKeyObj { public override string ToString() { return "*"; } } public static object AnyKey { get; } = new AnyKeyObj(); } }