src/Orleans.Core.Abstractions/Utils/IKeyedServiceCollection.cs
/// <summary>
/// Acquire a service by key, throwing if the service is not found.
/// </summary>
/// <typeparam name="TKey">
/// The service key type.
/// </typeparam>
/// <typeparam name="TService">
/// The service type.
/// </typeparam>
/// <param name="services">
/// The service provider.
/// </param>
/// <param name="key">
/// The service key.
/// </param>
/// <returns>The service.</returns>
Acquire a service by key, throwing if the service is not found.
Acquire a service by key throwing if the service is not found .
public static TService GetRequiredServiceByKey<TKey, TService>(this IServiceProvider services, TKey key)
            where TService : class
        {
            return services.GetServiceByKey<TKey, TService>(key) ?? throw new KeyNotFoundException(key?.ToString());
        }
public static TService GetRequiredServiceByKey < TKey , TService > ( this IServiceProvider services , TKey key ) where TService : class { return services . GetServiceByKey < TKey , TService > ( key ) ?? throw new KeyNotFoundException ( key ? . ToString ( ) ) ; }
Acquire a service by key, throwing if the service is not found.
Acquire a service by key throwing if the service is not found .
None
IServiceProvider
this
key
TKey
The service key.
The service key .
services
The service provider.
The service provider .
typeparam
The service key type.
The service key type .
typeparam
The service type.
The service type .