IFileExtensionRegistryService.AddFileExtension Method
Adds a new file extension to the registry.
Namespace: Microsoft.VisualStudio.Utilities
Assembly: Microsoft.VisualStudio.CoreUtility (in Microsoft.VisualStudio.CoreUtility.dll)
Syntax
'宣言
Sub AddFileExtension ( _
extension As String, _
contentType As IContentType _
)
void AddFileExtension(
string extension,
IContentType contentType
)
void AddFileExtension(
String^ extension,
IContentType^ contentType
)
abstract AddFileExtension :
extension:string *
contentType:IContentType -> unit
function AddFileExtension(
extension : String,
contentType : IContentType
)
Parameters
- extension
Type: System.String
The file extension. The period is optional.
- contentType
Type: Microsoft.VisualStudio.Utilities.IContentType
The content type for the file extension.
Exceptions
Exception | Condition |
---|---|
InvalidOperationException | extension is already present in the registry. |
Remarks
This method throws InvalidOperationException if the specified file extension is already present in the registry.
.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.