本文实例讲述了C#获取CPU编号的方法。分享给大家供大家参考。具体如下:
/// <summary>/// Gets the cpu 编号.///需引用 using System.Management;/// </summary>/// <returns></returns>public string GetCpuId(){ string cpuInfo = ""; ManagementClass cimobject = new ManagementClass("Win32_Processor"); ManagementObjectCollection moc = cimobject.GetInstances(); foreach (ManagementObject mo in moc) { cpuInfo = mo.Properties["ProcessorId"].Value.ToString(); } return cpuInfo;}
希望本文所述对大家的C#程序设计有所帮助。
新闻热点
疑难解答