ISupportRequiredService.GetRequiredService(Type) 方法

定义

从实现此接口的 IServiceProvider 中获取类型 serviceType 的服务。

public:
 System::Object ^ GetRequiredService(Type ^ serviceType);
public object GetRequiredService (Type serviceType);
abstract member GetRequiredService : Type -> obj
Public Function GetRequiredService (serviceType As Type) As Object

参数

serviceType
Type

要获取的服务对象的类型。

返回

类型为 serviceType的服务对象。 如果 IServiceProvider 无法创建对象,则引发异常。

例外

provider 已释放。

适用于