Mandar
Mandar

Reputation: 51

To check whether thread's apartment type is MTA or STA?

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

Answers (1)

Adil
Adil

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

Related Questions