C#中获取当前CPU编号和线程名称
1,在类中导入静态成员函数:
usingSystem.Runtime.InteropServices;
.....
[DllImport("kernel32.dll")]
externpublicstaticintGetCurrentProcessorNumber();
2,使用:
intmyProcessorNum=GetCurrentProcessorNumber();
stringthreadName=Thread.CurrentThread.Name;
本文介绍如何在C#中获取当前CPU编号和线程名称,包括导入必要的静态成员函数和使用示例。
1068

被折叠的 条评论
为什么被折叠?



