ArrayList and Generic Collections

what are the pros and cons to use ArrayList instead of the general collection in NET 2.0

+3
source share
1 answer

Shared collections are type safe - you cannot put stringin List<int>- and do not require constant boxing / unboxing from object.

ArrayListon the other hand, it can handle a combination of different elements - this can be a plus in some cases.

My trick: I usually always use it List<T>- unless I really need something that can handle int, string, DateTime, etc. at the same time (very rare).

+4
source

Source: https://habr.com/ru/post/1748112/


All Articles