IServiceProvider 介面

定義

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

public interface class IServiceProvider
public interface IServiceProvider
[System.Runtime.InteropServices.ComVisible(false)]
public interface IServiceProvider
type IServiceProvider = interface
[<System.Runtime.InteropServices.ComVisible(false)>]
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.HttpContext System.ComponentModel.LicenseContext System.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.

適用於

另請參閱