摘要:
发现网上到处都是com操作获取的代码,下面是4.0中引入新类DriverInfo的代码,希望能有帮助。privatelongGetFreeDiskSpaceInBytes(DirectoryInfodir){//dir.RootDriveInfo[]allDrives=DriveInfo.GetDrives();vardirver=allDrives.SingleOrDefault(di=>di.Name==dir.Root.Name);if(dirver!=null){returndirver.TotalFreeSpace;}return0;} 阅读全文