Condividi tramite


IFileExtensionRegistryService2.GetContentTypeForFileNameOrExtension Method

Definition

Gets the content type associated with the given file name or its extension.

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

Parameters

name
String

The file name. It cannot be null.

Returns

The IContentType associated with this name. 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