title: A generic list of anonymous class
body: <p>In C# 3.0 you can create anonymous class with the following syntax</p>
  
  <pre><code>var o = new { Id = 1, Name = "Foo" };
  </code></pre>
  
  <p>Is there a way to add these anonymous class to a generic list?</p>
  
  <p>Example:</p>
  
  <pre><code>var o = new { Id = 1, Name = "Foo" };
  var o1 = new { Id = 2, Name = "Bar" };
  
  List&lt;var&gt; list = new List&lt;var&gt;();
  list.Add(o);
  list.Add(o1);
  </code></pre>
  
  <p>Another Example:</p>
  
  <pre><code>List&lt;var&gt; list = new List&lt;var&gt;();
  
  while (....)
  {
      ....
      list.Add(new {Id = x, Name = y});
      ....
  }
  </code></pre>