Static properties
Properties require an instance of a type to be created before they can be accessed. Static properties, on the other hand, do not.
A static property is a piece of data; in some cases this includes constant values, associated with class definitions which can be retrieved without creating an object instance.
MSDN shows static properties using an S
symbol in the left-most column. For example, the System.Text.Encoding
class has a number of static properties denoting different text encoding types, shown in the following screenshot:
PowerShell is also able to list the static properties for a type (or class) using Get-Member
with the Static
switch:
PS> [System.Text.Encoding] | Get-Member -MemberType Property -Static TypeName: System.Text.Encoding Name MemberType Definition ---- ---------- ---------- ASCII Property static System.Text.Encoding ASCII {get;} BigEndianUnicode Property static System.Text.Encoding BigEndianUnicode {get;} Default ...