February 2019
Intermediate to advanced
626 pages
15h 51m
English
Arguments may be passed to the class constructor using a number of different approaches.
Using New-Object and the ArgumentList parameter, passing a single argument will use the second constructor in the list on MSDN (and in PowerShell):
PS> New-Object -TypeName System.Text.StringBuilder -ArgumentList 10Capacity MaxCapacity Length-------- ----------- ------ 10 2147483647 0
Alternatively, the following two approaches may be used:
New-Object System.Text.StringBuilder(10) [System.Text.StringBuilder]::new(10)
PowerShell decides which constructor to use based on the numbers and types of the arguments.
In the previous examples, one argument is passed; there are two possible constructors that accept a ...
Read now
Unlock full access