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()
Use this or a similar method inside the function:
System.Threading.Thread.CurrentThread.GetApartmentState
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With