Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个需要在 STA 公寓状态下运行的功能。我不想检查它是否作为 STA 运行,如果没有生成一个在 STA 中运行的新线程。
如何检查当前线程正在运行的公寓状态?
System.Threading.Thread.CurrentThread.GetApartmentState()
在函数中使用这个或类似的方法:
System.Threading.Thread.CurrentThread.GetApartmentState