PSObject Class

Encapsulates a base object of type Object or type PSCustomObject to allow for a consistent view of any object within the Windows PowerShell environment.


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

'Usage
Dim instance As PSObject

[SerializableAttribute] 
[TypeDescriptionProviderAttribute(typeof(PSObjectTypeDescriptionProvider))] 
public ref class PSObject : IFormattable, IComparable, ISerializable, 
	IDynamicMetaObjectProvider
/** @attribute SerializableAttribute() */ 
/** @attribute TypeDescriptionProviderAttribute(System.Management.Automation.PSObjectTypeDescriptionProvider) */ 
public class PSObject implements IFormattable, IComparable, 
	ISerializable, IDynamicMetaObjectProvider
SerializableAttribute 
TypeDescriptionProviderAttribute(System.Management.Automation.PSObjectTypeDescriptionProvider) 
public class PSObject implements IFormattable, IComparable, 
	ISerializable, IDynamicMetaObjectProvider

namespace HostPS1e
{
    class HostPS1e
    {
        static void Main(string[] args)
        {
            // Using the PowerShell.Create and AddCommand 
            // methods, create a command pipeline.
            PowerShell ps = PowerShell.Create().AddCommand("Sort-Object");

            // Using the PowerShell.Invoke method, run the command
            // pipeline using the supplied input.
            foreach (PSObject result in ps.Invoke(new int[] { 3, 1, 6, 2, 5, 4 }))
            {
                Console.WriteLine("{0}", result);
            } // End foreach.
            Console.ReadLine();
        } // End Main.
    } // End HostPS1e.
}

The PSObject object is the basis for access to all objects from the scripting language and provides an abstraction for the cmdlet developer.

It is permitted to derive from this class, but there is no established scenario for doing this.


System.Object
  System.Management.Automation.PSObject

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:
© 2014 Microsoft