I've got a DataTable dTable which hold several columns and rows.
I'm writing a function to shuffle the rows, therefore I want to copy the rows (with data) to a List. which I do with the following code:
List<DataRow> rows = new List<DataRow>(dTable.Rows.Count);
int count = 0;
foreach (DataRow rowname in dTable.Rows)
{
rows.Add(dTable.NewRow());
rows[count].BeginEdit();
rows[count] = (rowname);
}
Now I want to clear the DataTable dTable and randomly add the rows back to the DataTable, however if I add dTable.Clear(), the information in the rows in the List is also cleared, how do I remove the rows from the `DataTable' without loosing data in the List?