-
Notifications
You must be signed in to change notification settings - Fork 407
Description
Aside from the important remark:
Important
We don't recommend that you use the ArrayList class for new development. Instead, we recommend that you use the generic List class. The ArrayList class is designed to hold heterogeneous collections of objects. However, it does not always offer the best performance. Instead, we recommend the following:
For a heterogeneous collection of objects, use the List<Object> (in C#) or List(Of Object) (in Visual Basic) type.
For a homogeneous collection of objects, use the List<T> class. See Performance Considerations in the List reference topic for a discussion of the relative performance of these classes. See Non-generic collections shouldn't be used on GitHub for general information on the use of generic instead of non-generic collection types.
The ArrayList.Add method returns an index of added element which in most cases unintendedly leaks to the PowerShell pipeline and causes unexpected issues, see e.g.: