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.<
List
should generally be preferred over ArrayList
If you want lists you expose to callers to be immutable, this is supported by both List
and ArrayList
:
List.AsReadOnly()
ArrayList.ReadOnly(ArrayList list);
Your question asks about choosing between ArrayList
and List
, but your example shows an array, which is neither.