diff options
author | Andrew Ryan Davis <AndrewDavis1191@gmail.com> | 2020-08-16 14:58:29 -0700 |
---|---|---|
committer | Andrew Ryan Davis <AndrewDavis1191@gmail.com> | 2020-08-20 12:30:32 -0700 |
commit | 5c79b4288c9c1de5db6e1eb3856191f9381f7d4f (patch) | |
tree | 6b9ef84718ae7f4ac93269bae3aa520aacd342a7 /powershell.html.markdown | |
parent | f67ae9b31195a0bf30a18e892e755884aa54b1aa (diff) |
Adjusting array section to be more accurate
The default array object is mutable, but is of a fixed length. Changing comments to better reflect that.
Diffstat (limited to 'powershell.html.markdown')
-rw-r--r-- | powershell.html.markdown | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/powershell.html.markdown b/powershell.html.markdown index 45c47017..7c54dc44 100644 --- a/powershell.html.markdown +++ b/powershell.html.markdown @@ -183,11 +183,12 @@ $someVariable # => 5 # Ternary Operators exist in Powershell 7 and up 0 ? 'yes' : 'no' # => no -# The default array object in Powershell is an immutable array +# The default array object in Powershell is an fixed length array $defaultArray = "thing","thing2","thing3" -# you are unable to add or remove objects +# you can add objects with '+=', but cannot remove objects $defaultArray.Add("thing4") # => Exception "Collection was of a fixed size." -# To have a mutable array, you will need to use the .NET ArrayList class +# To have a more workable array, you'll want the .NET [ArrayList] class +# It is also worth noting that ArrayLists are significantly faster # ArrayLists store sequences [System.Collections.ArrayList]$array = @() |