c# - List<> Better to init with a maximum capacity and only use a fraction of that, or init with no capacity -


I have list is that I am starting to empty, and I have to populate this structure in a loop just as I parse the data. I know that the maximum possible number of entries to be entered in this list is 1000 for now. However, after my parsing of 1000 entries I can only put 2 in the list. So should I start a list of 1000 capacity or not specify any capacity and just add some entries. However this can end all adding 1000. What is the best way to display?

If it can be really different that broadly, then you do not want to set the capability For most collections, the more the capacity is, the same (as I believe is the default capacity of 16), so your ability comes to you very close to meet your maximum limit.


Comments

Popular posts from this blog

asp.net - Change the driver in the connection string to a data source in VB.Net -

Getting started consuming web services in a Ruby on Rails 3 application -

objective c - iPhone and it's wireless area -