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.

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

System.ComponentModel.LicenseContext System.Web.HttpContext System.ComponentModel.Design.ServiceContainer System.ComponentModel.MarshalByValueComponent介面是由數種類型所實作為, 包括、、和。 IServiceProviderThe 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.

適用於

另請參閱