IServiceProvider.GetService(Type) 方法

定义

获取指定类型的服务对象。Gets the service object of the specified type.

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

参数

serviceType
Type

一个对象,它指定要获取的服务对象的类型。An object that specifies the type of service object to get.

返回

Object

serviceType 类型的服务对象。A service object of type serviceType.

- 或 --or- 如果没有类型为 serviceType 的服务对象,则为 nullnull if there is no service object of type serviceType.

适用于