C#斷定指定驅動器能否曾經預備停當的辦法。本站提示廣大學習愛好者:(C#斷定指定驅動器能否曾經預備停當的辦法)文章只能為提供參考,不一定能成為您想要的結果。以下是C#斷定指定驅動器能否曾經預備停當的辦法正文
本文實例講述了C#斷定指定驅動器能否曾經預備停當的辦法。分享給年夜家供年夜家參考。詳細以下:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
class Program {
static void Main(string[] args) {
// Get info regarding all drives.
DriveInfo[] myDrives = DriveInfo.GetDrives();
// Now print stats.
foreach (DriveInfo d in myDrives) {
Console.WriteLine("Name: {0}", d.Name);
Console.WriteLine("Type: {0}", d.DriveType);
if (d.IsReady) {
Console.WriteLine("Free space: {0}", d.TotalFreeSpace);
Console.WriteLine("Format: {0}", d.DriveFormat);
Console.WriteLine("Label: {0}\n", d.VolumeLabel);
}
}
Console.ReadLine();
}
}
願望本文所述對年夜家的C#法式設計有所贊助。