Solution 1 would be correct if it explained
. It does not mean that you cannot add more items then
. You can. But all you need is to read the documentation:
Capacity is always greater than or equal to Count. If Count exceeds Capacity while adding elements, the capacity is automatically increased by reallocating the internal array before copying the old elements and adding the new elements.
More importantly: you should never use this list type
. It is rendered obsolete as early as of the .NET v.2.0, when generics were introduces. You should always use generic collection types from
(and also specialized collections). For a list, use
Non-generic types are much worse because they require potentially dangerous type cast. You never need them. However, these classes were not marked with
attribute, just because there is nothing wrong with using them in legacy code. In new development, there is absolutely no reason to use them.