110,533
社区成员
发帖
与我相关
我的任务
分享
static string A()
{
System.Management.ManagementClass mc = new System.Management.ManagementClass("win32_processor");
System.Management.ManagementObjectCollection moc = mc.GetInstances();
string str = "";
foreach (System.Management.ManagementObject mo in moc)
{
if (mo.Properties["Name"] != null
&& mo.Properties["Name"].Value != null)
{
Console.WriteLine("Name ................ : {0}", mo["Name"].ToString());
}
if (mo.Properties["Caption"] != null
&& mo.Properties["Caption"].Value != null)
{
Console.WriteLine("Caption ............. : {0}", mo["Caption"].ToString());
}
if (mo.Properties["processorid"] != null
&& mo.Properties["processorid"].Value != null)
{
Console.WriteLine("ProcessorID ......... : {0}", mo["processorid"].ToString());
}
if (mo.Properties["SystemName"] != null
&& mo.Properties["SystemName"].Value != null)
{
Console.WriteLine("SystemName .......... : {0}", mo["SystemName"].ToString());
}
}
return str.Trim();
}