本文介绍了如何获取PC(计算机)的ProcessorId的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获取ProcessorId.请建议使用function/method
I want to get ProcessorId .Please suggest te function/method
推荐答案
public static string GetProcessorID()
{
string sProcessorID = "";
string sQuery = "SELECT ProcessorId FROM Win32_Processor";
ManagementObjectSearcher oManagementObjectSearcher = new ManagementObjectSearcher(sQuery);
ManagementObjectCollection oCollection = oManagementObjectSearcher.Get();
foreach (ManagementObject oManagementObject in oCollection)
{
sProcessorID = (string)oManagementObject["ProcessorId"];
}
return (sProcessorID);
}
确保已添加system.Management命名空间和程序集
Make sure that you have added system.Management namespace and assembly
这篇关于如何获取PC(计算机)的ProcessorId的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!