IFileExtensionRegistryService2.GetContentTypeForFileName(String) 方法

定义

获取与给定文件名关联的内容类型。

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

参数

name
String

文件名。 不能为 null。

返回

IContentType

IContentType与此名称关联的。 如果不存在关联,它将返回 "unknown" 内容类型。 它从不返回 null。

注解

此方法尝试 IContentType 根据可用信息确定文件的。 为获得最佳结果,请使用 GetContentTypeForFilePath(String)

适用于