title: Initial capacity of collection types, e.g. Dictionary, List
body: <p>Certain collection types in .Net have an optional "Initial Capacity" constructor parameter.  For example:</p>
  
  <pre><code>Dictionary&lt;string, string&gt; something = new Dictionary&lt;string,string&gt;(20);
  
  List&lt;string&gt; anything = new List&lt;string&gt;(50);
  </code></pre>
  
  <p>I can't seem to find what the default initial capacity is for these objects on MSDN.</p>
  
  <p>If I know I will only be storing 12 or so items in a dictionary, doesn't it make sense to set the initial capacity to something like 20?</p>
  
  <p>My reasoning is, assuming that the capacity grows like it does for a StringBuilder, which doubles each time the capacity is hit, and each reallocation is costly, why not pre-set the size to something you know will hold your data, with some extra room just in case?  If the initial capacity is 100, and I know I will only need a dozen or so, it seems as though the rest of that memory is allocated for nothing.</p>