C# 获得硬盘参数程序代码
C# 获得硬盘参数程序代码如下:public static void HardDisk(out string[] 制造商, out string[] 型号, out string[] 序列号)
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");
制造商 = new string[searcher.Get().Count];
型号 = new string[searcher.Get().Count];
序列号 = new string[searcher.Get().Count];
int i = 0;
foreach (ManagementObject share in searcher.Get())
{
try
{
制造商[i] = share.GetPropertyValue("Manufacturer").ToString();
型号[i] = share.GetPropertyValue("Model").ToString();
序列号[i] = share.GetPropertyValue("Signature").ToString();
}
catch (System.Exception er)
{
}
i ;
}
}
补充:软件开发 , C# ,