title: C#: Add objects into List<T> class dynamically
body: <p>I want to add all my objects into an List dynamically, without any hard coding. </p>
  
  <p>Code:</p>
  
  <pre><code>static void Main(string[] args)
      {
          Item objA = new Item();
          Item objB = new Item();
          int count = Item.getCount();// count = 2
  
          List&lt;Item&gt; cont1 = new List&lt;Item&gt;();
          while (count &gt; 0)
          {
              for (int i = 0; i &lt; count; i++)
              {
                  cont1.Add();
                  //I missing an instance to get the objA and objB into cont1
                  //I dont want hard code it, e.g: cont1.Add(objA).
              }
  
          }
     }
  </code></pre>