Compartilhar via


PSObject Class

Definition

Wraps an object providing alternate views of the available members and ways to extend them. Members can be methods, properties, parameterized properties, etc.

public ref class PSObject : IComparable, IFormattable, System::Dynamic::IDynamicMetaObjectProvider, System::Runtime::Serialization::ISerializable
[System.Serializable]
public class PSObject : IComparable, IFormattable, System.Dynamic.IDynamicMetaObjectProvider, System.Runtime.Serialization.ISerializable
[System.ComponentModel.TypeDescriptionProvider(typeof(System.Management.Automation.PSObjectTypeDescriptionProvider))]
public class PSObject : IComparable, IFormattable, System.Dynamic.IDynamicMetaObjectProvider, System.Runtime.Serialization.ISerializable
[System.Serializable]
[System.ComponentModel.TypeDescriptionProvider(typeof(System.Management.Automation.PSObjectTypeDescriptionProvider))]
public class PSObject : IComparable, IFormattable, System.Dynamic.IDynamicMetaObjectProvider, System.Runtime.Serialization.ISerializable
public class PSObject : IComparable, IFormattable, System.Dynamic.IDynamicMetaObjectProvider, System.Runtime.Serialization.ISerializable
[<System.Serializable>]
type PSObject = class
    interface IFormattable
    interface IComparable
    interface ISerializable
    interface IDynamicMetaObjectProvider
[<System.ComponentModel.TypeDescriptionProvider(typeof(System.Management.Automation.PSObjectTypeDescriptionProvider))>]
type PSObject = class
    interface IDynamicMetaObjectProvider
    interface IComparable
    interface IFormattable
    interface ISerializable
[<System.Serializable>]
[<System.ComponentModel.TypeDescriptionProvider(typeof(System.Management.Automation.PSObjectTypeDescriptionProvider))>]
type PSObject = class
    interface IFormattable
    interface IComparable
    interface ISerializable
    interface IDynamicMetaObjectProvider
[<System.ComponentModel.TypeDescriptionProvider(typeof(System.Management.Automation.PSObjectTypeDescriptionProvider))>]
type PSObject = class
    interface IFormattable
    interface IComparable
    interface ISerializable
    interface IDynamicMetaObjectProvider
Public Class PSObject
Implements IComparable, IDynamicMetaObjectProvider, IFormattable, ISerializable
Inheritance
PSObject
Attributes
Implements

Remarks

It is permitted to subclass PSObject but there is no established scenario for doing this, nor has it been tested.

Constructors

PSObject()

Initializes a new instance of PSObject with an PSCustomObject BaseObject.

PSObject(Int32)

Initializes a new instance of PSObject with an PSCustomObject BaseObject with an initial capacity for members.

PSObject(Object)

Initializes a new instance of PSObject wrapping obj (accessible through BaseObject).

PSObject(SerializationInfo, StreamingContext)

Creates a PSObject from an ISerializable context.

Fields

AdaptedMemberSetName

The name of the member set for adapted members.

BaseObjectMemberSetName

The name of the member set for the BaseObject's members.

ExtendedMemberSetName

The name of the member set for extended members.

Properties

BaseObject

Gets the object we are wrapping.

ImmediateBaseObject

Gets the object we are directly wrapping.

Members

Gets the member collection.

Methods

Gets the Method collection, or the members that are actually methods.

Properties

Gets the Property collection, or the members that are actually properties.

TypeNames

Gets the type names collection initially containing the object type hierarchy.

Methods

AsPSObject(Object)

If obj is an PSObject it will be returned as is, otherwise a new PSObject will be created based on obj.

CompareTo(Object)

Compares the current instance with another object of the same type.

Copy()

Returns a copy of this PSObject. This will copy the BaseObject if it is a value type, and use BaseObject.Clone() for the new PSObject, if the BaseObject is ICloneable.

Equals(Object)

Determines whether the specified Object is equal to the current Object.

GetHashCode()

Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.

GetObjectData(SerializationInfo, StreamingContext)

Implements the ISerializable contract for serializing a PSObject.

ToString()

Returns the string representation for this object. A ToString CodeMethod or ScriptMethod will be used, if available. Enumerations items are concatenated using $ofs.

ToString(String, IFormatProvider)

Returns the string representation for this object. A ToString CodeMethod or ScriptMethod will be used, if available. Enumerations items are concatenated using $ofs.

Operators

Implicit(Boolean to PSObject)
Implicit(Double to PSObject)
Implicit(Hashtable to PSObject)
Implicit(Int32 to PSObject)
Implicit(String to PSObject)

Explicit Interface Implementations

IDynamicMetaObjectProvider.GetMetaObject(Expression)

Applies to