Freigeben über


IFileExtensionRegistryService.GetContentTypeForExtension(String) Method

Definition

Gets the content type associated with the given file extension.

public:
 Microsoft::VisualStudio::Utilities::IContentType ^ GetContentTypeForExtension(System::String ^ extension);
public:
 Microsoft::VisualStudio::Utilities::IContentType ^ GetContentTypeForExtension(Platform::String ^ extension);
Microsoft::VisualStudio::Utilities::IContentType GetContentTypeForExtension(std::wstring const & extension);
public Microsoft.VisualStudio.Utilities.IContentType GetContentTypeForExtension (string extension);
abstract member GetContentTypeForExtension : string -> Microsoft.VisualStudio.Utilities.IContentType
Public Function GetContentTypeForExtension (extension As String) As IContentType

Parameters

extension
String

The file extension. It cannot be null, and it should not contain a period.

Returns

The IContentType associated with this extension. If no association exists, it returns the "unknown" content type. It never returns null.

Remarks

This method attempts to determine the IContentType of the file based on the information available. For best results, use GetContentTypeForFilePath(String).

Applies to