Which is better? array, ArrayList or List<T> (in terms of performance and speed)
arraylist, arrays, c#, list, performance
Solution
`List<T>` should generally be preferred over `ArrayList`
- faster for value types as it avoids boxing.
- strongly typed elements
If you want lists you expose to callers to be immutable, this is supported by both `List<T>` and `ArrayList`:
List<T>.AsReadOnly()
ArrayList.ReadOnly(ArrayList list);
Your question asks about choosing between `ArrayList` and `List<T>`, but your example shows an array, which is neither.
Problem
I require a fast speed in processing my page. The count of the values to be added will be dynamic. Which one of the above is preferred? Support with a valid reason. Edit: For eg: ``` string str = "a,b,c"; //Count of the number of elements in str is not fixed string[] arr = str.Split(','); ``` or, ``` ArrayList al = new ArrayList(); al.Add(str.Split(',')); ```