title: How to use HyperDescriptor to fasten the conversion?
body: <p>I have a list of objects as the following :</p>
  
  <pre><code>List&lt;UserTransactionDTO&gt;
  </code></pre>
  
  <hr>
  
  <p>and i want to convet this list to a <code>Datatable</code> .</p>
  
  <p>I search  and found the following link :</p>
  
  <p><a href="https://stackoverflow.com/questions/564366/convert-generic-list-enumerable-to-datatable">Convert generic List/Enumerable to DataTable?</a></p>
  
  <p>It works for me but i don't know how to implement <code>HyperDescriptor</code> to make it faster .Is there some dll  to use ?</p>
  
  <hr>
  
  <p>I just use the following code in the previous link and it works fine  :</p>
  
  <pre><code>public static DataTable ToDataTable&lt;T&gt;(this IList&lt;T&gt; data)
  {
      PropertyDescriptorCollection props =
          TypeDescriptor.GetProperties(typeof(T));
      DataTable table = new DataTable();
      for(int i = 0 ; i &lt; props.Count ; i++)
      {
          PropertyDescriptor prop = props[i];
          table.Columns.Add(prop.Name, prop.PropertyType);
      }
      object[] values = new object[props.Count];
      foreach (T item in data)
      {
          for (int i = 0; i &lt; values.Length; i++)
          {
              values[i] = props[i].GetValue(item);
          }
          table.Rows.Add(values);
      }
      return table;        
  }
  </code></pre>