I have below code to get individual drive's information but I want the whole HDD informationie.I.E. total size and used or available space
public List<DriveInformation> GetDriveInfo()
{
List<DriveInformation> info = new List<DriveInformation>();
DriveInfo[] drives = DriveInfo.GetDrives();
foreach (DriveInfo drive in drives)
{
DriveInformation temp = new DriveInformation();
temp.driveName = drive.Name;
temp.driveSize = drive.TotalSize.ToString();
temp.availableSize = drive.TotalFreeSpace.ToString();
info.Add(temp);
}
return info;
}
if I have an unallocated drive then drive info unable to show that space.
ex: I have 500GB HDD and there is 2(C & D) partitions 200 each then this function give only infromation about C and D. I also want the Unallocated space detail(I.E.another 100GB) whether it is used or unallocated.