Udostępnij za pośrednictwem


VsShellUtilities.TryGetPackageExtensionPoint<TExtensionPoint,TInterface> Method

Definition

Create an instance of an extension point from the given package. This is analagous to finding an "Export" of a given type (T) with instance metadata given by the "instance" Guid.

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

Type Parameters

TExtensionPoint

Type of extension point

TInterface

Interface requested

Parameters

package
Guid

Package containing the instance

instance
Guid

Instance identifier for the requested extension point

Returns

TInterface

The extension point

Exceptions

The extension point is not recognized by the package, or the package does not use attributes to declare any class that implements the extension.

The package does not implement the Microsoft.VisualStudio.Shell.Interop.VsPackageExtensionProvider interface, or the extension provider was created but it does not implement the TInterface interface.

Applies to