IServiceProvider 介面

定義

定義機制來擷取服務物件,也就是為其他物件提供自訂支援的物件。Defines a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.

public interface class IServiceProvider
[System.Runtime.InteropServices.ComVisible(false)]
public interface IServiceProvider
type IServiceProvider = interface
Public Interface IServiceProvider
衍生
屬性

備註

這個介面是由提供服務給其他物件的類別或實數值型別所實。This interface is implemented by a class or value type that provides a service to other objects.

此介面的 GetService 方法會取得提供服務的物件。The GetService method of this interface obtains the object that provides the service.

IServiceProvider 介面是由數種類型所實作為,包括 System.Web.HttpContextSystem.ComponentModel.LicenseContextSystem.ComponentModel.MarshalByValueComponentSystem.ComponentModel.Design.ServiceContainerThe IServiceProvider interface is implemented by a number of types, including System.Web.HttpContext, System.ComponentModel.LicenseContext, System.ComponentModel.MarshalByValueComponent, and System.ComponentModel.Design.ServiceContainer.

方法

GetService(Type)

取得指定類型的服務物件。Gets the service object of the specified type.

適用於

另請參閱