title: How to create a List with a dynamic object type
body: <p>How can I create a new <code>List&lt;T&gt;</code> where the <strong>T</strong> is a  <strong>dynamic</strong> Type object.</p>
  
  <p>I have</p>
  
  <pre class="lang-c# prettyprint-override"><code>dynamic DyObj = new ExpandoObject();
  
  if (condition1)
  {
    DyObj.Required = true;
    DyObj.Message = "This is the first property being accessed through dynamic object";
  }
  if (condition2)
  {
      DyObj.Required = false;
      DyObj.Message = "This is the second property....";
  }
  // and so on...
  </code></pre>
  
  <p>I want to create <code>List&lt;Dyobj&gt;</code> and assign all the messages to <code>Dyobj</code> based on conditions. </p>
  
  <p>Follow up data from comments:  </p>
  
  <pre class="lang-c# prettyprint-override"><code>var DyObjectsList = new List&lt;dynamic&gt;; 
  dynamic DyObj = new ExpandoObject(); 
  if (condition1) { 
      DyObj.Required = true; 
      DyObj.Message = "Message 1"; 
      DyObjectsList.Add(DyObj); 
  } 
  if (condition2) { 
      DyObj.Required = false; 
      DyObj.Message = "Message 2"; 
      DyObjectsList.Add(DyObj); 
  } 
  </code></pre>
  
  <p>interestingly all the objects in DyObjectsList are replaced with the values of the last assigned object.</p>