Partager via


AsyncServiceProviderInjection<TService,TInterface>.GetServiceAsync Méthode

Définition

Surcharges

GetServiceAsync()

Retourne de manière asynchrone le service récupéré.

GetServiceAsync(Boolean)

Retourne de manière asynchrone le service récupéré.

GetServiceAsync()

Retourne de manière asynchrone le service récupéré.

public System.Threading.Tasks.Task<TInterface> GetServiceAsync();
member this.GetServiceAsync : unit -> System.Threading.Tasks.Task<'Interface (requires 'Interface : null)>
Public Function GetServiceAsync () As Task(Of TInterface)

Retours

Task<TInterface>

Instance du TService service.

Exceptions

S’il n’existe aucun service de type TService disponible.

Remarques

Plusieurs appels à cette méthode retournent le même instance de TInterface.

S’applique à

GetServiceAsync(Boolean)

Retourne de manière asynchrone le service récupéré.

public System.Threading.Tasks.Task<TInterface?> GetServiceAsync(bool assumePresent);
member this.GetServiceAsync : bool -> System.Threading.Tasks.Task<'Interface (requires 'Interface : null)>
Public Function GetServiceAsync (assumePresent As Boolean) As Task(Of TInterface)

Paramètres

assumePresent
Boolean

Retours

Task<TInterface>

Instance du TService service.

Exceptions

Quand assumePresent est et qu’aucun service de type TService n’est true disponible.

Remarques

Plusieurs appels à cette méthode retournent le même instance de TInterface.

S’applique à