ServiceProvider.GetRequiredKeyedService(Type, Object) Metod

Definition

Hämtar tjänstobjektet av den angivna typen.

public:
 virtual System::Object ^ GetRequiredKeyedService(Type ^ serviceType, System::Object ^ serviceKey);
public object GetRequiredKeyedService(Type serviceType, object? serviceKey);
abstract member GetRequiredKeyedService : Type * obj -> obj
override this.GetRequiredKeyedService : Type * obj -> obj
Public Function GetRequiredKeyedService (serviceType As Type, serviceKey As Object) As Object

Parametrar

serviceType
Type

Vilken typ av tjänst som ska hämtas.

serviceKey
Object

Nyckeln för den tjänst som ska hämtas.

Returer

Den nyckelade tjänsten.

Implementeringar

Undantag

Tjänsten hittades inte eller så AnyKey används värdet för serviceKey när serviceType inte är en uppräkningsbar baserat på IEnumerable<T>.

Gäller för