C#中获取当前CPU编号和线程名称
1,在类中导入静态成员函数:
usingSystem.Runtime.InteropServices;
.....
[DllImport("kernel32.dll")]
externpublicstaticintGetCurrentProcessorNumber();
2,使用:
intmyProcessorNum=GetCurrentProcessorNumber();
stringthreadName=Thread.CurrentThread.Name;