title: Creating Dynamic Objects
body: <p>How to dynamically create objects?</p>
  
  <pre><code>string[] columnNames = { "EmpName", "EmpID", "PhoneNo" };
  List&lt;string[]&gt; columnValues = new List&lt;string[]&gt;();
  for (int i = 0; i &lt; 10; i++)
  {
      columnValues.Add(new[] { "Ramesh", "12345", "12345" });
  }
  
  List&lt;Dictionary&lt;string, object&gt;&gt; testData = new List&lt;Dictionary&lt;string, object&gt;&gt;();
  
  foreach (string[] columnValue in columnValues)
  {
      Dictionary&lt;string, object&gt; data = new Dictionary&lt;string, object&gt;();
      for (int j = 0; j &lt; columnNames.Count(); j++)
      {
          data.Add(columnNames[j], columnValues[j]);
      }
      testData.Add(data);
  }
  </code></pre>
  
  <p><strong>Imaginary Class(Class is not available in code):</strong></p>
  
  <pre><code>class Employee
  {
      string EmpName { get;set; }
      string EmpID { get;set; }
      string PhoneNo { get;set; }
  }
  </code></pre>
  
  <p><strong>Note:</strong> Property/column names are dynamic.</p>
  
  <p>Now I want to convert the <code>List&lt;Dictionary&lt;string, object&gt;&gt;</code> to a class of type <code>List&lt;object&gt;</code> (i.e) <code>List&lt;Employee&gt;</code>.</p>
  
  <p>Is it Possible? Suggestions please.</p>