A column named 'Item' already belongs to this DataTable
<p>I am trying to convert a <code>List</code> to a <code>datatable</code> with an extension method. Implementation is: </p>

<p><b>Extension method</b></p>

<pre><code>public static class list2Dt
    {
        public static DataTable ToDataTable&lt;T&gt;(List&lt;T&gt; items)
        {
            DataTable dataTable = new DataTable(typeof(T).Name);

            //Get all the properties
            PropertyInfo[] Props = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
            foreach (PropertyInfo prop in Props)
            {
                //Setting column names as Property names
                dataTable.Columns.Add(prop.Name);
            }
            foreach (T item in items)
            {
                var values = new object[Props.Length];
                for (int i = 0; i &lt; Props.Length; i++)
                {
                    //inserting property values to datatable rows
                    values[i] = Props[i].GetValue(item, null);
                }
                dataTable.Rows.Add(values);
            }
            //put a breakpoint here and check datatable
            return dataTable;
        }
    }
</code></pre>

<p><b>Controller</b></p>

<pre><code>var noDups = firstTable.AsEnumerable()
                            .GroupBy(d =&gt; new
                            {
                                name = d.Field&lt;string&gt;("name"),
                                date = d.Field&lt;string&gt;("date")
                            })
                            .Where(d =&gt; d.Count() &gt; 1) 
                            .Select(d =&gt; d.First())
                             .ToList();

                        DataTable secondTable = new DataTable();
                        secondTable.Columns.Add("name", typeof(string));
                        secondTable.Columns.Add("date", typeof(string));
                        secondTable.Columns.Add("clockIn", typeof(string));
                        secondTable.Columns.Add("clockOut", typeof(string));

                        secondTable = list2Dt.ToDataTable(noDups);
</code></pre>

<p>I am getting this following error: </p>

<pre><code>An exception of type 'System.Data.DuplicateNameException' occurred in System.Data.dll but was not handled in user code

Additional information: A column named 'Item' already belongs to this DataTable.
</code></pre>

<p>Above error is raised on line:  </p>

<pre><code>dataTable.Columns.Add(prop.Name);
</code></pre>

<p>Can someone find where problem lies. </p>