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(','));
List<T>should generally be preferred overArrayListIf you want lists you expose to callers to be immutable, this is supported by both
List<T>andArrayList:Your question asks about choosing between
ArrayListandList<T>, but your example shows an array, which is neither.