title: Constraints are not allowed on non-generic declaration
body: <p>After some Google i found following code that can help to convert data row to specifics class </p>
  
  <pre><code>public static void SetItemFromRow(T item, DataRow row) where T : new()
  {
      // go through each column
      foreach (DataColumn c in row.Table.Columns)
      {
          // find the property for the column
          PropertyInfo p = item.GetType().GetProperty(c.ColumnName);
  
          // if exists, set the value
          if (p != null &amp;&amp; row[c] != DBNull.Value)
          {
              p.SetValue(item, row[c], null);
          }
      }
  }
  
  // function that creates an object from the given data row
  public static T CreateItemFromRow(DataRow row) where T : new()
  {
      // create a new object
      T item = new T();
  
      // set the item
      SetItemFromRow(item, row);
  
      // return 
      return item;
  }
  
  public static List CreateListFromTable(DataTable tbl) where T : new()
  {
      // define return list
      List lst = new List();
  
      // go through each row
      foreach (DataRow r in tbl.Rows)
      {
          // add to the list
          lst.Add(CreateItemFromRow(r));
      }
  
      // return the list
      return lst;
  }
  </code></pre>
  
  <p>But both of them are giving me this error "<strong>Constraints are not allowed on non-generic declaration</strong>" I have Google a lot but no help regarding my function</p>
  
  <p>The main thing i want is to make genric function that convert data table to list of class
   &amp; data row to class </p>