VsShellUtilities.TryGetPackageExtensionPoint<TExtensionPoint,TInterface> 方法

定义

从给定的包创建扩展点的实例。 这是类似于使用 "实例" Guid 提供的实例元数据查找给定类型 (T) 的 "导出"。

public:
generic <typename TExtensionPoint, typename TInterface>
 where TExtensionPoint : class where TInterface : class static TInterface TryGetPackageExtensionPoint(Guid package, Guid instance);
public static TInterface TryGetPackageExtensionPoint<TExtensionPoint,TInterface> (Guid package, Guid instance) where TExtensionPoint : class where TInterface : class;
static member TryGetPackageExtensionPoint : Guid * Guid -> 'Interface (requires 'ExtensionPoint : null and 'Interface : null)
Public Shared Function TryGetPackageExtensionPoint(Of TExtensionPoint As Class, TInterface As Class) (package As Guid, instance As Guid) As TInterface
Public Function TryGetPackageExtensionPoint(Of TExtensionPoint As Class, TInterface As Class) (package As Guid, instance As Guid) As TInterface

类型参数

TExtensionPoint

扩展点的类型

TInterface

请求的接口

参数

package
Guid

包含实例的包

instance
Guid

请求的扩展点的实例标识符

返回

TInterface

扩展点

例外

包不能识别扩展点,或者包不使用属性声明任何实现扩展的类。

包未实现 Microsoft.VisualStudio.Shell.Interop.VsPackageExtensionProvider 接口,或者已创建扩展提供程序,但它未实现 TInterface 接口。

适用于