List<String>
is implemented using an array String[]
.
If you don't know how many elements you'll have, use List<String>
You can give the estimated (or maximum) number of elements you expect in the capacity constructor parameter (new List<String>(10)
), this will be the initial size of the underlying array.
When you Add()
an item and there is no room for this item, the underlying array is copied to a new array of double the size.
What I do: when I know the exact size of the collection and I know I won't change the size of the collection, I use an array (String[]
). Otherwise I use a List<String>
.
By the way, this goes for any type and not just String
.