Use the DriveFormat property to get the drive format in C#.
Set the drive for which you want to display the format −
DriveInfo dInfo = new DriveInfo("C");Now, use DriveFormat to get the drive format −
dInfo.DriveFormat
The drive formats for a windows system can be NTFS or FAT32.
Here is the complete code −
Example
using System;
using System.Linq;
using System.IO;
public class Demo {
public static void Main() {
DriveInfo dInfo = new DriveInfo("C");
Console.WriteLine("Drive Format = "+dInfo.DriveFormat);
}
}Output
The following is the output −
Drive Format = NTFS