February 2019
Intermediate to advanced
626 pages
15h 51m
English
PowerShell does not have a means of strictly enforcing the output from a script or function.
Any statement—composed of any number of commands, variables, properties, and method calls—may generate output. This output will be automatically sent to the output pipeline by PowerShell as it is generated. Unanticipated output can cause bugs in code.
The following function makes use of the StringBuilder type. Many of the methods on StringBuilder return the StringBuilder instance. This is shown here:
PS> using namespace System.TextPS> $stringBuilder = [StringBuilder]::new()PS> $stringBuilder.AppendLine('First')Capacity MaxCapacity Length-------- ----------- ------ 16 2147483647 7
This is useful in that it allows chaining to build up ...
Read now
Unlock full access