RegisterEditorExtensionAttribute Constructor
Initializes a new RegisterEditorExtensionAttribute for the supplied factory type and extension.
Namespace: Microsoft.VisualStudio.Shell
Assembly: Microsoft.VisualStudio.Shell.11.0 (in Microsoft.VisualStudio.Shell.11.0.dll)
Syntax
'宣言
Public Sub New ( _
factoryType As Object, _
extension As String, _
priority As Integer _
)
public RegisterEditorExtensionAttribute(
Object factoryType,
string extension,
int priority
)
Parameters
- factoryType
Type: System.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: System.String
The file extension to associate with the editor factory. This extension should include the prefix ".".
- priority
Type: System.Int32
The priority of this editor factory. Editors with higher priority numbers are given a chance to read a file first. Upon failure, the next editor in priority order is used.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | This method throws an ArgumentNullException if:
|
ArgumentException | This method throws an ArgumentException if:
|
Remarks
This constructor is useful if you do not have access to the editor factory because it is implemented elsewhere.
Examples
The following C# code applies the RegisterEditorExtension attribute to a VSPackage named BasicEditor.
using Microsoft.VisualStudio.Shell;
using MSVSIP = Microsoft.VisualStudio.Shell;
[MSVSIP.RegisterEditorExtension(typeof(EditorFactory), ".myext", 32, "{A2FE74E1-B743-11d0-AE1A-00A0C90FFFC3}", "..\\..\\Templates", 106)]
public class BasicEditor : MSVSIP.Package {}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.