Compartilhar via


ProvideEditorExtensionAttribute Constructor

Initializes an instance of ProvideEditorExtensionAttribute.

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

Syntax

'Declaration
Public Sub New ( _
    factoryType As Object, _
    extension As String, _
    priority As Integer _
)
public ProvideEditorExtensionAttribute(
    Object factoryType,
    string extension,
    int priority
)
public:
ProvideEditorExtensionAttribute(
    Object^ factoryType, 
    String^ extension, 
    int priority
)
new : 
        factoryType:Object * 
        extension:string * 
        priority:int -> ProvideEditorExtensionAttribute
public function ProvideEditorExtensionAttribute(
    factoryType : Object, 
    extension : String, 
    priority : int
)

Parameters

  • factoryType
    Type: Object

    One of following types:

    The type of the editor factory expressed as a string.

    The GUID of the editor factory.

    The type of the editor factory.

  • extension
    Type: String

    The file extension to associate with the editor factory. This extension should include the prefix ".".

  • priority
    Type: Int32

    The priority of this editor factory. The editors with the higher priority number is given a chance to read a file first. Upon failure, the next editor in priority is used.

Remarks

This constructor is useful if you do not have access to the editor factory because it is implemented elsewhere.

Exceptions

Exception type

Condition

ArgumentNullException

This method throws an ArgumentNullException if:

  • Factory GUID value passed in factoryType is nulla null reference (Nothing in Visual Basic).

  • Factory string is nulla null reference (Nothing in Visual Basic).

  • Extension is nulla null reference (Nothing in Visual Basic).

ArgumentException

This method throws an ArgumentException if:

  • The factory GUID string cannot be converted to a GUID object.

  • Extension does not begin with a ".".

Examples

The following C# code applies the ProvideEditorExtension attribute to a VSPackage named BasicEditor.

[ProvideEditorExtension(typeof(EditorFactory), ".myext", 32, "{A2FE74E1-B743-11d0-AE1A-00A0C90FFFC3}", "..\\..\\Templates", 106)]
public class BasicEditor : Package {}

.NET Framework Security

See Also

Reference

ProvideEditorExtensionAttribute Class

Microsoft.VisualStudio.Shell Namespace