title: Array of dynamic | ExpandoObject | with a compressed initialize syntax
body: <p>Im trying to use DynamicObject in c#, and I needed an array of dynamic:</p>
  
  <pre><code>var d = new dynamic[];
  </code></pre>
  
  <p>which works fine. </p>
  
  <p>EDIT : See ExpandoObject below.</p>
  
  <p>But I also like to fill that array with some data with this compressed initialize new syntax:</p>
  
  <pre><code>var d = new dynamic[] { 
    new {
     Name = "Some",
     Number = 1010
    },
    new {
     Name = "Other",
     Number = 2010
    }
   }
  </code></pre>
  
  <p>But in that case all objects gets the non-dynamic type "object" and a loop through the items will give me an exception:</p>
  
  <pre><code>foreach (dynamic item in d)
  {
    @item.Name
    @item.Number
  }
  </code></pre>
  
  <p>Error : 'object' does not contain a definition for 'Name'. I guess I just initialize the array items the wrong way. How to add dynamic objects instead?</p>
  
  <p>EDIT: New content:</p>
  
  <p>I realize "dynamic" does not have the capability to dynamically add properties. </p>
  
  <p>I better be using ExpandoObject which exposes all items in an an internal dictionary as properties. But unfortunately ExpandoObject does not seem to support this nice compressed create syntax, and the compiler complains:</p>
  
  <pre><code>var d = new ExpandoObject[]{
  new ExpandoObject(){
      Name="Nnn",
      Number=1080
      }
  }
  </code></pre>
  
  <p>So the answer might just be : it's not possible.</p>