Runspace.ApartmentState Property

Gets the apartment state of the thread used to run commands in the runspace. This property must be set before the runspace is opened.This property is introduced in Windows PowerShell 2.0.


Namespace: System.Management.Automation.Runspaces
Assembly: System.Management.Automation (in System.Management.Automation.dll)

'Usage
Dim instance As Runspace
Dim value As ApartmentState

value = instance.ApartmentState

instance.ApartmentState = value

public ApartmentState ApartmentState { get; set; }
/** @property */
public ApartmentState get_ApartmentState ()

/** @property */
public void set_ApartmentState (ApartmentState value)

public function get ApartmentState () : ApartmentState

public function set ApartmentState (value : ApartmentState)

Property Value

An ApartmentState constant that identifies the apartment state of the thread used to run commands in the runspace.

For more information about runspaces and runspace pools, see Host Application Runspaces.

noteNote:
The user at the command line may not necessarily realize that the commands that Windows PowerShell runs are being processed within a runspace. From the command-line user’s point of view, commands are run in a Windows PowerShell session. From a host application’s point of view, commands are run within a runspace.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

 

Target Platforms


Show:
© 2015 Microsoft