📅  最后修改于: 2022-03-11 14:49:14.650000             🧑  作者: Mango
string cpuID = string.Empty;
ManagementClass mc = new ManagementClass("win32_processor");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
if (cpuID == "")
{
//Remark gets only the first CPU ID
cpuID = mo.Properties["processorID"].Value.ToString();
}
}
return cpuID;