Sim*_*mon 8 .net c# filesystems
是否可以使用.NET C#3.5读取有关物理磁盘的文件系统的信息(例如,如果它被格式化为NTFS,FAT等)?
如果是这样,我应该用哪个类来确定这个?
Cod*_*ray 11
是的,这是可能的.查询DriveFormat属性的的System.IO.DriveInfo类.
public static void Main()
{
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
Console.WriteLine("Drive {0}", d.Name);
Console.WriteLine("Type: {0}", d.DriveFormat);
}
}
Run Code Online (Sandbox Code Playgroud)