由网友(戒つ)分享简介:我有一个功能,它要求将在STA公寓状态下运行。我wan't检查它是否正在运行的STA,如果没有产卵它运行在STA一个新的线程。 我怎么能检查哪些单元状态当前线程正在运行? 解决方案 System.Threading.Thread.CurrentThread.GetApartmentState()I have a...![线程的状态](https://p.xsw88.cn/allimgs/daicuo/20230903/3473.png)
我有一个功能,它要求将在STA公寓状态下运行。我wan't检查它是否正在运行的STA,如果没有产卵它运行在STA一个新的线程。
我怎么能检查哪些单元状态当前线程正在运行?
解决方案 System.Threading.Thread.CurrentThread.GetApartmentState()
I have a function which requires to be run in STA apartment state. I wan't to check if it is being run as STA, and if not spawn a new thread which runs in STA.
![线程的状态](https://p.xsw88.cn/allimgs/daicuo/20230903/3473.png)
How can I check which apartment state the current thread is being run in?
解决方案System.Threading.Thread.CurrentThread.GetApartmentState()
相关推荐
最新文章