c#获取机器码

C#获得机器码  




private static string GetCpuId()
        {
            string cpuInfo = " ";
            using (ManagementClass cimobject = new ManagementClass("Win32_Processor"))
            {
                ManagementObjectCollection moc = cimobject.GetInstances();


                foreach (ManagementObject mo in moc)
                {
                    cpuInfo = mo.Properties["ProcessorId"].Value.ToString();
                    mo.Dispose();
                }
            }
            return cpuInfo.ToString();
        }




c#  listbox多选


设置 selectionmode属性 为multisimple

你可能感兴趣的:(String,C#)