[C#] C#判断指定的驱动器是否已经准备好了 →→→→→进入此内容的聊天室

来自 , 2019-04-10, 写在 C#, 查看 110 次.
URL http://www.code666.cn/view/d914a6c6
  1.  
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.IO;
  6.  
  7. class Program {
  8.     static void Main(string[] args) {
  9.         // Get info regarding all drives.
  10.         DriveInfo[] myDrives = DriveInfo.GetDrives();
  11.  
  12.         // Now print stats.
  13.         foreach (DriveInfo d in myDrives) {
  14.             Console.WriteLine("Name: {0}", d.Name);
  15.             Console.WriteLine("Type: {0}", d.DriveType);
  16.  
  17.             if (d.IsReady) {
  18.                 Console.WriteLine("Free space: {0}", d.TotalFreeSpace);
  19.                 Console.WriteLine("Format: {0}", d.DriveFormat);
  20.                 Console.WriteLine("Label: {0}\n", d.VolumeLabel);
  21.             }
  22.         }
  23.         Console.ReadLine();
  24.     }
  25. }
  26. //csharp/7643

回复 "C#判断指定的驱动器是否已经准备好了"

这儿你可以回复上面这条便签

captcha