Last active
December 27, 2022 04:15
-
-
Save techthoughts2/fd284787eee122e8c50fd21fc6b1ea29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use generic list to add objects in a performant way | |
$starTrekShowInfo = New-Object System.Collections.Generic.List[string] | |
$starTrekShowInfo.Add('Star Trek: The Next Generation') | |
# use custom objects for high performance adds of custom object | |
$choiceArray = New-Object System.Collections.Generic.List[PSCustomObject] | |
#------------------------------------------------------------------------------ | |
# old method which should no longer be used IAW: | |
# https://docs.microsoft.com/en-us/dotnet/api/system.collections.arraylist?view=net-6.0 | |
# adding stuff to emtpy array objects quickly | |
$myarray = [System.Collections.ArrayList]::new() | |
[void]$myArray.Add('Value') | |
#------------------------------------------------------------------------------ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment