As commented, the Add() method on an ArrayList outputs the index into which the new item is added. To suppress this output, just do $null = $newobj.Add($nobj) or [void]$newobj.Add($nobj)

As for the Remove() method in a Generic List, it works for me if I specify the object to remove correctly:

$Collection = New-Object System.Collections.Generic.List[System.Object]
$items = 'foo', 'bar', 'baz'
foreach ($item in $items) {
    $obj = New-Object PSCustomObject
    $obj | Add-Member -NotePropertyName Property1 -NotePropertyValue $item
    $obj | Add-Member -NotePropertyName Property2 -NotePropertyValue ""
    $obj | Add-Member -NotePropertyName Property3 -NotePropertyValue ""
    $Collection.Add($obj)

    # or simply do
    # $Collection.Add([PsCustomObject]@{Property1 = $item; Property2 = ''; Property3 = ''})
}

To create a copy of the collection, you can do:

$newCollection = [PsCustomObject[]]::new($Collection.Count)
$Collection.CopyTo($newCollection)

Remove one object from the original $Collection:

Collection | Where-Object {$_.Property1 -eq 'bar'}
[void]$Collection.Remove(Collection

Output:

Property1 Property2 Property3
--------- --------- ---------
foo                          
baz                          
Answer from Theo on Stack Overflow
🌐
Reddit
reddit.com › r/powershell › copy-item with array list - how to reference it?
Copy-item with array list - how to reference it? : r/PowerShell
July 19, 2021 - Sometimes it downloads 480p, 720p, 1440p files & those are the ones I want to delete automatically, but for testing purposes move them to a newfolder like the example above. So if they include 480p, 720p or 1440p in the name, then to auto delete them. I found I could do it with 1 keyword here, but can't figure out how to do more than 1: ... This is where powershell's terrific regex support comes in handy with the -match operator.
🌐
Powershelladmin
powershelladmin.com › wiki › Deep_copying_arrays_and_objects_in_PowerShell.php
Deep copying arrays and objects in PowerShell - PowerShellAdmin.com
February 27, 2026 - For PSObjects that don't have nested properties you can also serialize and get rid of the connection to the original object (the "$Object" variable in the example below), by converting to CSV and back via the PS cmdlets built into PSv2 and up: ConvertTo-Csv and ConvertFrom-Csv. PS C:\temp> $Object = New-Object -TypeName PSObject -Property @{ key = 'value' } # Create a regular (reference) copy.
Discussions

How to create an ArrayList from an Array in PowerShell? - Stack Overflow
I've got a list of files in an array. I want to enumerate those files, and remove specific files from it. Obviously I can't remove items from an array, so I want to use an ArrayList. But the follow... More on stackoverflow.com
🌐 stackoverflow.com
Adding arrays to arraylists
I have an object which is of type {system.collections.arraylist] To add a single element I can use the Add method but to add an array I have to use the ‘+=’ method. Does anyone have a technical explanation for this as ‘+=’ doesnt seem to be in the microsoft doco below: I am also assuming ... More on forums.powershell.org
🌐 forums.powershell.org
7
0
July 11, 2022
PowerShell copy an array completely - Stack Overflow
I'm trying to create a complete copy of an existing array. Every time I try this it doesn't seem to work. The thing is that I'm modifying the object names inside the new copied array, but they're a... More on stackoverflow.com
🌐 stackoverflow.com
Two ways of creating a new System.Collections.ArrayList object, what's the difference?
Yes, you create an empty array then use it to initialize the variable. Two other ways (System not needed as its namespace is already loaded): [Collections.ArrayList]$list = @() $list = [Collections.ArrayList]::new() New-Object is useful when you need -ComObject, or to dynamically create a type (typename stored as a string that you may not know when writing). It is the 'older' method before powershell had classes built-in. Also, if you create an 'untyped' variable from a cast, you can change its type later on. The first example I posted enforces the type for that variable, it can only be an arraylist. I recommend using the generic types where you can specify the type: [Collections.Generic.List[String]]$list = @() $list = [Collections.Generic.List[Int]]::new() Also save some typing and use a namespace: using namespace System.Collections.Generic [List[String]]$list = @() $list = [List[Int]]::new() And for speed (enumeration access), if the items are unique, try a HashSet: using namespace System.Collections.Generic [HashSet[String]]$list = @() $list = [HashSet[Int]]::new() You should be measuring speed on insertion/removal and access for real world speed tests. And you'll definitely see different results when you go past milestones like 10, 1000, 10000 items (generics are tailored to large datasets). More on reddit.com
🌐 r/PowerShell
11
27
April 7, 2023
🌐
Enterprise DNA
blog.enterprisedna.co › powershell-arraylist
Powershell ArrayList: How to Build Better Scripts – Master Data Skills + AI
Shallow copy: When an ArrayList is cloned using the ICloneable interface, it creates a shallow copy, which refers to a new ArrayList object containing references to the same elements as the original. Keep this in mind when working with reference types, as changing the original elements will also affect the cloned ArrayList. Mastering the PowerShell ArrayList allows for efficient and flexible data management.
🌐
SharePoint Diary
sharepointdiary.com › sharepoint diary › powershell › powershell tutorials › powershell arraylist – a beginners guide!
PowerShell ArrayList - A Beginners Guide! - SharePoint Diary
September 30, 2025 - Both methods will create a new ArrayList object, which you can then use to store and manipulate data in your PowerShell script.
🌐
| How
pipe.how › new-arraylist
PowerShell Collections: ArrayList | How
January 17, 2020 - One uses New-Object and the other calls the constructor of the class. You’re free to use whichever you prefer, although when sharing scripts it might be worth considering that people that are just getting into PowerShell and learning commands may be confused at the second one. So far it’s nothing too exciting, but let’s have a look at the type and members of it to see if we can spot some differences to a normal Array. PipeHow:\Blog> $ArrayList.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True ArrayList System.Object
🌐
PowerShell Forums
forums.powershell.org › powershell help
Adding arrays to arraylists - PowerShell Help - PowerShell Forums
July 11, 2022 - I have an object which is of type {system.collections.arraylist] To add a single element I can use the Add method but to add an array I have to use the ‘+=’ method. Does anyone have a technical explanation for this as ‘+=’ doesnt seem to be in the microsoft doco below: I am also assuming that ‘+=’ does not destroy and rebuild the arraylist everytime an array is added?
Find elsewhere
🌐
Java2Blog
java2blog.com › home › powershell › powershell array › convert array to arraylist in powershell
Convert Array to ArrayList in PowerShell [2 Ways] - Java2Blog
April 16, 2023 - Once you have an ArrayList object, you can use its methods and properties to manipulate the data. These methods are as follows: ... Let’s continue learning these methods. Using the Add() to add a new element to ArrayList.
🌐
PowerShell Test-Path
powershellfaqs.com › convert-an-arraylist-to-an-array-in-powershell
How to Convert an ArrayList to an Array in PowerShell?
February 9, 2024 - The most straightforward way to convert an ArrayList to an array in PowerShell is by using the ToArray() method. This method is a member of the ArrayList class and converts the entire ArrayList into an array. Here’s how you can use it: # Create an ArrayList and add some items $arrayList = ...
🌐
SPGuides
spguides.com › powershell-arraylist
PowerShell ArrayList [Create and Use]
March 26, 2025 - To create an ArrayList in PowerShell, you can use the New-Object command or directly call the constructor of the System.Collections.ArrayList class.
🌐
CodeProject
codeproject.com › Questions › 648481 › Copying-an-ArrayList-to-another-ArrayList
Copying an ArrayList to another ArrayList
September 4, 2013 - Do not try and find the page. That’s impossible. Instead only try to realise the truth - For those who code; Updated: 1 Jul 2007
🌐
Adam the Automator
adamtheautomator.com › powershell-array
PowerShell Arrays, ArrayLists & Collections: Best Practices
Using a PowerShell ArrayList is also a way in which you can store a list of items with PowerShell. The ArrayList class is part of the System.Collections namespace within .NET. By creating a new object of this type you can then store objects within an ArrayList. Below you can see that you need to explicitly create an ArrayList object using the New-Object cmdlet or by casting a standard array to an ArrayList object.
Published   April 22, 2025
🌐
Vexx32
vexx32.github.io › 2020 › 02 › 15 › Building-Arrays-Collections
Building Arrays and Collections in PowerShell
PowerShell checks the size of the collection in $array and the number of items being added to it (in this case, just one each time). PowerShell creates a completely different array of the correct size. The original array is copied into this new array, along with the new item(s).
🌐
Kamil Pro
kamilpro.com › posts › powershell array and arraylist - storing multiple items as a one variable
PowerShell Array and ArrayList - storing multiple items as a one variable | Kamil Pro
August 23, 2021 - # PowerShell however allows you to do that, hiding all complexity # by creating a new array, copying all existing item, adding new one # and finally removing old array. # If you plan to add items to your array, look at ArrayList and List below # Adding elements to array $Week $Week.Add("January") #this throws an error $Week += "January" $Week # Adding arrays together $ArrayA = 1..10 $ArrayB = 11..20 $ArrayA + $ArrayB ############# # ArrayList # ############# #Adding items to ArrayList $alist = [System.Collections.ArrayList]::new() #This is .Net framework $alist.Add("January") [void]$alist.Add("February") #Void stops prevents writing to console $alist # Removing from ArrayList $alist.Remove($alist[1]) $alist
🌐
Stuart Moore
stuart-moore.com › home › deep copy arrays in powershell
Deep copy arrays in PowerShell - Stuart Moore
November 24, 2017 - There are various workarounds kicking around if you’re using simple arrays, but they tend to breakdown when you’ve got arrays that contain arrays or other PowerShell objects. My method for copying them is a little down and dirty, but it works 95% of the time for what I want. The trick is to Serialize the object, and then DeSerialize it into the new one:
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › system.collections.arraylist.clone
ArrayList.Clone Method (System.Collections) | Microsoft Learn
November 17, 2022 - A shallow copy of the ArrayList. ... A shallow copy of a collection copies only the elements of the collection, whether they are reference types or value types, but it does not copy the objects that the references refer to. The references in the new collection point to the same objects that the references in the original collection point to.
🌐
Reddit
reddit.com › r/powershell › two ways of creating a new system.collections.arraylist object, what's the difference?
r/PowerShell on Reddit: Two ways of creating a new System.Collections.ArrayList object, what's the difference?
April 7, 2023 -

I've come across two ways of creating a new System.Collections.ArrayList object:

$arrA = New-Object System.Collections.ArrayList
$arrB = [System.Collections.ArrayList]@() 

I have two questions:

  1. for arrB, if I'm reading this right, @() is creating an empty array and then it's being cast into [System.Collections.ArrayList]?

  2. Working with the created object is the same for me either way, but are there any differences I may be missing?

I made a quick test and casting was faster, but the difference is only noticeable when creating new arrays reaches the hundreds of thousands to millions (tested on an old A10-7870k). Doesn't really matter when I'm creating one array, but I thought it was mildly interesting.

$max = 100000
$ticksStart = (Get-Date).Ticks
for ($i = 0; $i -lt $max; $i++)
{
	$arrA = New-Object System.Collections.ArrayList
}
$ticksEnd = (Get-Date).Ticks
Write-Host 'arrA (ticks)	: ' ($ticksEnd - $ticksStart)

$ticksStart = (Get-Date).Ticks
for ($i = 0; $i -lt $max; $i++)
{
	$arrB = [System.Collections.ArrayList]@()
}
$ticksEnd = (Get-Date).Ticks
Write-Host  'arrB (ticks)	: ' ($ticksEnd - $ticksStart)
arrA (ticks)	:  64310000
arrB (ticks)	:  3170000
🌐
Microsoft Learn
learn.microsoft.com › en-us › powershell › scripting › learn › deep-dives › everything-about-arrays
Everything you wanted to know about arrays - PowerShell | Microsoft Learn
July 20, 2024 - The quick answer is that you can't. An array is a fixed size in memory. If you need to grow it or add a single item to it, then you need to create a new array and copy all the values over from the old array.