Reputation: 51
Is there any way so that i can check the apartment type of thread,whether it is MTA or STA while debugging an application on runtime ? I am working on winforms application in visual studio 2008 IDE.
Upvotes: 1
Views: 1659
Reputation: 148150
You can use Thread.GetApartmentState to get ApartmentState of the current thread. This method will return you ApartmentState
Enumeration that has values STA
, MTA
and Unknown
If you want to set the ApartmentState you can use Thread.SetApartmentState
Upvotes: 3