title: Convert DataTable to generic List?
body: <pre><code>    public static IList&lt;T&gt; ConvertTo&lt;T&gt;(DataTable table)
      {
          if (table == null)
          {
              return null;
          }
  
          List&lt;DataRow&gt; rows = new List&lt;DataRow&gt;();
  
          foreach (DataRow row in table.Rows)
          {
              rows.Add(row);
          }
  
          return ConvertTo&lt;T&gt;(rows);
      }
  
      public static T ConvertItem&lt;T&gt;(DataTable table)
      {
          T obj = default(T);
          if (table != null &amp;&amp; table.Rows.Count &gt; 0)
          {
              obj = CreateItem&lt;T&gt;(table.Rows[0]);
          }
          return obj;
      }
  
  
      public static T CreateItem&lt;T&gt;(DataRow row)
      {
          T obj = default(T);
          if (row != null)
          {
              obj = Activator.CreateInstance&lt;T&gt;();
              Type entityType = typeof(T);
              PropertyInfo[] properties = entityType.GetProperties();
  
              for (int i = 0; i &lt; properties.Length; i++)
              {
                  object[] customAttributes = properties[i].GetCustomAttributes(typeof(ColumnAttributes), false);
                  ColumnAttributes dataField = null;
                  if (null != customAttributes &amp;&amp; customAttributes.Length &gt; 0 &amp;&amp; null != (dataField = customAttributes[0] as ColumnAttributes))
                  {
                      if (row.Table.Columns.Contains(dataField.FieldName) &amp;&amp; !row[dataField.FieldName].GetType().FullName.Equals("System.DBNull"))
                      {
                          properties[i].SetValue(obj, row[dataField.FieldName], null);
                      }
                  }
              }
          }
          return obj;
      }
  </code></pre>
  
  <p>Thats the only thing we can think of right now is that we must be doing something where we need to Garbage collect Ourselves?</p>
  
  <p>Thoughts?</p>
  
  <p>Why we think there might be a leak?:</p>
  
  <p>We are getting Out of Memory Errors. If a Page does not require business logic to use this type of conversion, the II6 process does not grow, but when we hit a page that uses it, it grows. </p>
  
  <p>We are currently getting ANTS Profiler to give us more details.</p>