Partager via


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

'Declaration
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: String

    The file extension. The period is optional.

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

See Also

Reference

IFileExtensionRegistryService Interface

Microsoft.VisualStudio.Utilities Namespace