February 2019
Intermediate to advanced
626 pages
15h 51m
English
In PowerShell 5.0 and higher, an object instance may be created using the new static method:
$stringBuilder = [System.Text.StringBuilder]::new()
For earlier versions of PowerShell, the object instance may be created using the following syntax:
$stringBuilder = New-Object System.Text.StringBuilder
PowerShell has added the static method (discussed later in this chapter); it can be used if required, but it isn't documented on the MSDN page for StringBuilder.
Once an instance of StringBuilder has been created, it can be viewed:
PS> $stringBuilder = New-Object System.Text.StringBuilderPS> $stringBuilderCapacity MaxCapacity Length-------- ----------- ------ 16 2147483647 0
The StringBuilder object has a number of other ...
Read now
Unlock full access