The
System.Management.Automation.PSMemberTypes
enum is an enumeration (with
FlagsAttribute
) that enumerates the possible member types with which a
PowerShell object can be extended in the
Extended Type System or refer to a .NET member.
Enum name | Value | Comment | .NET member |
AliasProperty | 1 | An alias to another member | |
CodeProperty | 2 | Reference to a method | |
Property | 4 | A property from the BaseObject | ✓ |
NoteProperty | 8 | Name-value pair | |
ScriptProperty | 16 | A property defined by script language | |
PropertySet | 32 | Set of properties | |
Method | 64 | A method from the BaseObject, or made accessible through an adapter | ✓ |
CodeMethod | 128 | A method that is implemented in a CLR language | |
ScriptMethod | 256 | A method that is implemented from a PowerShell Scripts | |
ParameterizedProperty | 512 | A member that acts like a property that takes parameters. This is not consider to be a property or a method. | |
MemberSet | 1024 | A set of members | |
Event | 2048 | All events | ✓ |
Dynamic | 4096 | All dynamic members (where PowerShell cannot know the type of the member) | |
InferredProperty | 8192 | | |
The .NET property types Property, Method and Events
In most cases, a PowerShell object (which is an instance of
System.Management.Automation.PSObject
) wraps a
.NET object (See also the
Extended Type System). The members of the underlying .NET object have one of the object types
Method
,
Property
or
Event
. These are marked with a ✓ in the last column of the first table.
Members with another member type are added to the PowerShell object and are independent from the underlying .NET object.
Such members can be added with the
add-member
cmdLet. (See especially the
-memberType
option of that cmdLet).