实习任务 实现获取磁盘的详细信息(容量、状态、签名)!求指导! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 要调用 api,网上很多方法的 参考http://developer.51cto.com/art/200908/146032.htm 调用api,自己去百度找资料去看 添加引用using System.IO;使用获取磁盘信息DriveInfo[] myDrives = DriveInfo.GetDrives(); 用 System.IO 命名空间下的 DriveInfo类DriveInfo[] allDrives = DriveInfo.GetDrives();//检索计算机上的所有逻辑驱动器的驱动器名称 foreach (DriveInfo d in allDrives)//循环输出各分区的信息 { Console.WriteLine("Drive {0}", d.Name); Console.WriteLine(" File type: {0}", d.DriveType);//驱动器类型 if (d.IsReady == true) { Console.WriteLine(" Volume label: {0}", d.VolumeLabel);//分区的卷标 Console.WriteLine(" File system: {0}", d.DriveFormat);//分区的文件系统类型 Console.WriteLine( " Available space to current user:{0, 15} bytes", d.AvailableFreeSpace);//指示驱动器上的可用空闲空间量。 Console.WriteLine( " Total available space: {0, 15} bytes", d.TotalFreeSpace);获取驱动器上的可用空闲空间总量 Console.WriteLine( " Total size of drive: {0, 15} bytes ", d.TotalSize);获取驱动器上存储空间的总大小 } } 请那位高手帮帮忙 高分求一正则表达式!! 一个特别的字符串匹配的问题 循环显示图片 nhibernate中用linq条件查询,tolist全部都是重复记录 winfrom 数据绑定的一个问题,求大师解答 求一个正则表达式,高手帮个忙! 在线等待关于frame 怎样在C#里把String转换成Dtatime? C#如何调用API?? 关于C#的一些数学计算的小问题 解决弹出对话框时原Web窗体显示为空白
http://developer.51cto.com/art/200908/146032.htm
using System.IO;使用获取磁盘信息
DriveInfo[] myDrives = DriveInfo.GetDrives();
DriveInfo[] allDrives = DriveInfo.GetDrives();//检索计算机上的所有逻辑驱动器的驱动器名称 foreach (DriveInfo d in allDrives)//循环输出各分区的信息
{
Console.WriteLine("Drive {0}", d.Name);
Console.WriteLine(" File type: {0}", d.DriveType);//驱动器类型
if (d.IsReady == true)
{
Console.WriteLine(" Volume label: {0}", d.VolumeLabel);//分区的卷标
Console.WriteLine(" File system: {0}", d.DriveFormat);//分区的文件系统类型
Console.WriteLine(
" Available space to current user:{0, 15} bytes",
d.AvailableFreeSpace);//指示驱动器上的可用空闲空间量。 Console.WriteLine(
" Total available space: {0, 15} bytes",
d.TotalFreeSpace);获取驱动器上的可用空闲空间总量 Console.WriteLine(
" Total size of drive: {0, 15} bytes ",
d.TotalSize);获取驱动器上存储空间的总大小
}
}