1 System.IO.DriveInfo[] hardDiskDrives = System.IO.DriveInfo.GetDrives();
2 foreach (System.IO.DriveInfo hardDiskDrive in hardDiskDrives)
3 {
4 if(hardDiskDrive.DriveType.ToString() != "CDRom")
5 {
6 totalSize = hardDiskDrive.TotalSize / (1024 * 1024 * 1024);
7 totalFreeSpace = hardDiskDrive.TotalFreeSpace / (1024 * 1024 * 1024);
8 textBoxDisksVolumn.Text += hardDiskDrive.Name + " " + totalSize.ToString() + "GB ";
9 textBoxAvalaibleSpace.Text += hardDiskDrive.Name + " " + totalFreeSpace.ToString() + "GB ";
10 }
11 }