PS> [hashtable]::new OverloadDefinitions ------------------- hashtable new() hashtable new(int capacity) hashtable new(int capacity, float loadFactor) Methods A Windows PowerShell class method is implemented as a ScriptBlock that has only an end block. All methods are public. The following shows an example of defining a method named DoSomething. class MyClass { DoSomething($x) { $this._doSomething($x) # method syntax } private _doSomething($a) {} } Method invocation: $b = [MyClass]::new() $b.DoSomething(42) Overloaded methods—that is, those that are named the same as an existing method, but differentiated by their specified values—are also supported. Properties All properties are public. Properties require either a newline or semicolon. If no object type is specified, the property type is object. Properties that use validation attributes or argument transformation attributes (e.g. [ValidateSet("aaa")]) work as expected. Hidden A new keyword, Hidden, has been added. Hidden can be applied to properties and methods (including constructors). Hidden members are public, but do not appear in the output of Get-Member unless the -Force parameter is added. Hidden members are not included when tab completing or using Intellisense unless the completion occurs in the class defining the hidden member. A new attribute,
PS> [hashtable]::new OverloadDefinitions ------------------- hashtable new() hashtable new(int capacity) hashtable new(int capacity, float loadFactor) Methods A Windows PowerShell class method is implemented as a ScriptBlock that has only an end block. All methods are public. The following shows an example of defining a method named DoSomething. class MyClass { DoSomething($x) { $this._doSomething($x) # method syntax } private _doSomething($a) {} } Method invocation: $b = [MyClass]::new() $b.DoSomething(42) Overloaded methods—that is, those that are named the same as an existing method, but differentiated by their specified values—are also supported. Properties All properties are public. Properties require either a newline or semicolon. If no object type is specified, the property type is object. Properties that use validation attributes or argument transformation attributes (e.g. [ValidateSet("aaa")]) work as expected. Hidden A new keyword, Hidden, has been added. Hidden can be applied to properties and methods (including constructors). Hidden members are public, but do not appear in the output of Get-Member unless the -Force parameter is added. Hidden members are not included when tab completing or using Intellisense unless the completion occurs in the class defining the hidden member. A new attribute,
Windows-Management-Framework-5.0-Production-Preview-Release-Notes.docx