如何检查当前线程的单元状态?线程、单元、状态

由网友(戒つ)分享简介:我有一个功能,它要求将在STA公寓状态下运行。我wan't检查它是否正在运行的STA,如果没有产卵它运行在STA一个新的线程。 我怎么能检查哪些单元状态当前线程正在运行? 解决方案 System.Threading.Thread.CurrentThread.GetApartmentState()I have a...

我有一个功能,它要求将在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.

线程的状态

How can I check which apartment state the current thread is being run in?

解决方案

System.Threading.Thread.CurrentThread.GetApartmentState()

阅读全文

相关推荐

最新文章