以下代码未正确显示版本信息。
ManagementObjectSearcher mos = new ManagementObjectSearcher(new SelectQuery("Win32_Processor"));
ManagementObjectCollection moc = mos.Get();
foreach (ManagementObject mo in moc)
{
Console.WriteLine("Version: " +mo["Version"].ToString());
}
显示空白屏幕。
我正在使用Windows 7版本......
如何解决......?
答案 0 :(得分:1)
这可以帮到你:
// Enumerate the Win32_Processor class
EnumerationOptions opt = new EnumerationOptions();
ManagementClass c = new ManagementClass("Win32_Processor");
foreach (ManagementObject o in c.GetInstances(opt))
{
foreach (var item in o.Properties)
{
Console.WriteLine(item.Name + " " + item.Value);
}
}