C#获取机器码的CS文件 //获取CPU序列号代码 string cpuInfo = "";//cpu序列号 ManagementClass mc = new ManagementClass("Win32_Processor"); ManagementObjectCollection moc = mc.GetInstances(); foreach (ManagementObject mo in moc) { cpuInfo = mo.Properties["ProcessorId"].Val
本文实例讲述了C#获取机器码的方法。分享给大家供大家参考,具体如下:
using System.Runtime.InteropServices;
using System.Management;
using System;
public class HardwareInfo
{
//取机器名
public string GetHostName()
{
return System.Net.Dns.GetHostName();
}
//取CPU编号
public Str