FileSystemInfo.Extension 属性
获取表示文件扩展名部分的字符串。
**命名空间:**System.IO
**程序集:**mscorlib(在 mscorlib.dll 中)
语法
声明
Public ReadOnly Property Extension As String
用法
Dim instance As FileSystemInfo
Dim value As String
value = instance.Extension
public string Extension { get; }
public:
property String^ Extension {
String^ get ();
}
/** @property */
public String get_Extension ()
public function get Extension () : String
属性值
包含 FileSystemInfo 扩展名的字符串。
备注
Extension 属性返回 FileSystemInfo 扩展名(包括句点 (.))。例如,对于文件 c:\NewFile.txt,此属性返回“.txt”。
下表列出了其他典型或相关的 I/O 任务的示例。
若要执行此操作... |
请参见本主题中的示例... |
---|---|
创建文本文件。 |
|
写入文本文件。 |
|
读取文本文件。 |
|
检索文件的完全限定路径。 |
|
只检索路径中的文件名。 |
|
只检索路径中的目录名。 |
|
更改文件扩展名。 |
平台
Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
.NET Compact Framework
受以下版本支持:2.0、1.0
请参见
参考
FileSystemInfo 类
FileSystemInfo 成员
System.IO 命名空间