我有一个需要在STA单元状态下运行的函数。我想要检查它是否正在作为STA运行,如果没有,则生成一个新线程在STA中运行。
我如何检查当前线程正在运行哪个单元状态?
System.Threading.Thread.CurrentThread.GetApartmentState()
System.Threading.Thread.CurrentThread.GetApartmentState