Normally when I want to grab a copy of an existing DataTable I call the Copy method are return the value to a new object.
I've been cleaning up some legacy code and noticed using Clone and then iterating through each row and calling ImportRow into the new DataTable.
'is this...
TempTable = myDataTable.Clone
For Each dr As DataRow In myDataTable.Rows
TempTable.ImportRow(dr)
Next
'the same as this...
TempTable = myDataTable.Copy
I'd like to clean it up and simplify by using the Copy method, but just want to make sure I'm not breaking anything. Is there a difference between the two methods here about holding references or doing a deep vs. shallow copy?