Edit

Share via


IKeyedServiceCollection<TKey,TService> Interface

Definition

Collection of services that can be disambiguated by key

public interface IKeyedServiceCollection<in TKey,out TService> where TService : class
public interface IKeyedServiceCollection<TKey,out TService> where TService : class
type IKeyedServiceCollection<'Key, 'Service (requires 'Service : null)> = interface
Public Interface IKeyedServiceCollection(Of In TKey, Out TService)
Public Interface IKeyedServiceCollection(Of TKey, Out TService)

Type Parameters

TKey

The service key type.

This type parameter is contravariant. That is, you can use either the type you specified or any type that is less derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
TService

The service type.

This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
Derived

Methods

GetService(IServiceProvider, TKey)

Gets the service with the specified key.

GetService(TKey)
GetServices(IServiceProvider)

Gets all services from this collection.

Applies to