- 阅读权限
- 255
- 威望
- 0 级
- 论坛币
- 50288 个
- 通用积分
- 83.6306
- 学术水平
- 253 点
- 热心指数
- 300 点
- 信用等级
- 208 点
- 经验
- 41518 点
- 帖子
- 3256
- 精华
- 14
- 在线时间
- 766 小时
- 注册时间
- 2006-5-4
- 最后登录
- 2022-11-6
|
- LISTING 4-1 Listing drive information
- DriveInfo[] drivesInfo = DriveInfo.GetDrives();
- foreach (DriveInfo driveInfo in drivesInfo)
- {
- Console.WriteLine(“Drive {0}”, driveInfo.Name);
- Console.WriteLine(“ File type: {0}”, driveInfo.DriveType);
- if (driveInfo.IsReady == true)
- {
- Console.WriteLine(“ Volume label: {0}”, driveInfo.VolumeLabel);
- Console.WriteLine(“ File system: {0}”, driveInfo.DriveFormat);
- Console.WriteLine(
- “ Available space to current user:{0, 15} bytes”,
- driveInfo.AvailableFreeSpace);
- Console.WriteLine(
- “ Total available space: {0, 15} bytes”,
- driveInfo.TotalFreeSpace);
- Console.WriteLine(
- “ Total size of drive: {0, 15} bytes “,
- driveInfo.TotalSize);
- }
- }
复制代码
|
|