IComponentModel.GetService<T> 方法

定义

从默认的组合容器中获取 "服务",即,给定组合容器中只能存在一个实例的对象。 等于直接调用 GetExportedValue<T>()

public:
generic <typename T>
 where T : class T GetService();
public:
generic <typename T>
 where T : class T GetService();
template <typename T>
 where T : class T GetService();
public T GetService<T> () where T : class;
abstract member GetService : unit -> 'T (requires 'T : null)
Public Function GetService(Of T As Class) () As T

类型参数

T

要获取的对象类型。

返回

T

所请求的对象的实例。

适用于