As some of the below articles note, using += with an Array object can be very slow, as it copies the Array into a new Array in-memory. The recommendation is very often to use List objects instead of Arrays to avoid this problem.
Thoughts?
https://stackoverflow.com/questions/14620290/powershell-array-add-vs
https://powershell.org/2013/09/16/powershell-performance-the-operator-and-when-to-avoid-it/
When used in a loop, it's probably a good idea. Otherwise, it may be annoying because there are many reasonable applications of += that may be even faster or just cleaner. New-Object System.Collections.Generic.List[System.Object] is quite an expression to type, parse, evaluate.
Good idea in general but I also agree with @nightroman that one does not care in most situations. I think it would make sense to group PSScriptAnalyzer warnings into something like 3 categories so that one can either configure PSScriptanalyzer to apply only rules of those categories or alternatively filter for them later on:
Most helpful comment
Good idea in general but I also agree with @nightroman that one does not care in most situations. I think it would make sense to group PSScriptAnalyzer warnings into something like 3 categories so that one can either configure PSScriptanalyzer to apply only rules of those categories or alternatively filter for them later on: