Synopsis: | Use List<> instead of ArrayList especially for value types |
Language: | C# |
Severity Level: | 7 |
Category: | Performance |
Description: |
For value types, the List<> is up to 20x faster than the ArrayList. For type string, there is no difference. (This is mainly caused by the fact that the ArrayList, which is a 'left over' from .NET 1.0, is boxing the values and the List<> isn't.) To prevent potential performance problems in this area the recommendation is to ALWAYS use List<>. |