title: Fill DataSet from List of class Items
body: <p>I've searched SO for common questions, but they didn't match my task.
  I have a class with many(about 50) <code>ValueTyped</code> properties.
  And there are needs to fill a <code>new DataSet</code> object with class's properties.</p>
  
  <p>For example, if I have this:</p>
  
  <pre><code>public partial class MyClass
  {
      public int Id {get; set;}
      public string Name {get; set;}
      // and other public properties
  }
  </code></pre>
  
  <p>I need a two functions to return </p>
  
  <ol>
  <li><p>Filled DataSet with a single row for single MyClass item.</p></li>
  <li><p>Filled DataSet with a multiple rows for multiple MyClass items.</p></li>
  </ol>
  
  <hr>
  
  <pre><code>public partial class MyClass
  {
      public DataSet GenerateDataSet(MyClass source);
  
      public DataSet GenerateDataSet(IEnumerable&lt;MyClass&gt; source);
  }
  </code></pre>
  
  <p>I've tried many solutions like below, but it's unable to compile since <code>DataRow</code> doesn't have public constructor.</p>
  
  <pre><code>var ds = new DataSet();
  ds.Tables.Add(new DataTable("DataTableName"));
  var table = ds.Tables[0];
  table.Rows.Add(new DataRow(new DataRowBuilder(table, 0)));
  </code></pre>