Container.GetService(Type) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient l’objet de service du type spécifié, s’il est disponible.
protected:
virtual System::Object ^ GetService(Type ^ service);
protected virtual object GetService(Type service);
abstract member GetService : Type -> obj
override this.GetService : Type -> obj
Protected Overridable Function GetService (service As Type) As Object
Paramètres
Retours
Implémentation Object du service demandé ou null si le service ne peut pas être résolu.
Remarques
L’implémentation par défaut de cette méthode retourne l’instance actuelle de la classe si service elle est une IContainer; sinon, elle retourne null. Vous pouvez remplacer cette méthode pour fournir une implémentation personnalisée pour retourner un objet de service. Pour plus d’informations, consultez la IServiceProvider.GetService méthode.