NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Thread.ApartmentState

Gets or sets the apartment state of this thread.

[Visual Basic]
Public Property ApartmentState As ApartmentState
[C#]
public ApartmentState ApartmentState {get; set;}
[C++]
public: __property ApartmentState get_ApartmentState();
public: __property void set_ApartmentState(ApartmentState);
[JScript]
public function get ApartmentState() : ApartmentState;
public function set ApartmentState(ApartmentState);

Property Value

One of the ApartmentState values. The initial value is Unknown.

Exceptions

Exception Type Condition
ArgumentException An attempt is made to set this property to a state that is not a valid apartment state (a state other than STA or MTA).

Remarks

A thread can be marked to indicate that it will execute in a single-threaded or multithreaded apartment. The property can be set when the thread is in the Unstarted or Running thread state; however, it can be set only once for a thread. If the property has not been set, it returns Unknown.

See Also

Thread Class | Thread Members | System.Threading Namespace | ThreadState