If you're new to Powershell or if you've been around the block a few times but have no background in C#, then you may benefit from the advantages of using C#.NET's List
classes. The class is fully documented here:
Take a look. There are multiple pre-built methods that come in very handy with Powershell scripts. Some of my favorites are Count(), Contains(T), Reverse(), Sort() and many more.
Leveraging lists is easy once you've defined them in Powershell thusly:
$list = New-Object -TypeName System.Collections.Generic.List[String];
So go ahead and give List
a try in your scripts... you'll never use arrays again!