Share via


VsShellUtilities.GetPackageExtensionPoint<TExtensionPoint, TInterface> Method

Creates 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 GUID of the instance.

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.12.0 (in Microsoft.VisualStudio.Shell.12.0.dll)

Syntax

'Declaration
Public Shared Function GetPackageExtensionPoint(Of TExtensionPoint As Class, TInterface As Class) ( _
    package As Guid, _
    instance As Guid _
) As TInterface
public static TInterface GetPackageExtensionPoint<TExtensionPoint, TInterface>(
    Guid package,
    Guid instance
)
where TExtensionPoint : class 
where TInterface : class
public:
generic<typename TExtensionPoint, typename TInterface>
where TExtensionPoint : ref class 
where TInterface : ref class 
static TInterface GetPackageExtensionPoint(
    Guid package, 
    Guid instance
)
static member GetPackageExtensionPoint : 
        package:Guid * 
        instance:Guid -> 'TInterface  when 'TExtensionPoint : not struct when 'TInterface : not struct
JScript does not support generic types or methods.

Type Parameters

  • TExtensionPoint
    The type of extension point.
  • TInterface
    The interface.

Parameters

  • package
    Type: Guid

    The package that contains the instance.

  • instance
    Type: Guid

    The instance identifier for the requested extension point.

Return Value

Type: TInterface
The extension point.

Exceptions

Exception Condition
ArgumentException

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

InvalidCastException

The package does not implement the IVsPackageExtensionProvider interface, or the extension provider was created but it does not implement the TInterface interface

.NET Framework Security

See Also

Reference

VsShellUtilities Class

Microsoft.VisualStudio.Shell Namespace