Should I be concerned about the classic "Deep/Shallow" copy problem
when returning objects, specifically a DataTable or DataView from a
method? For example, see the code below:
private DataTable LoadStuff()
{
DataTable dt = new DataTable();
....
dt.Columns.Add(...)
....
dt.Rows.Add(...)
return dt;
}
Will the memory allocated within this function be valid outside of the
function after the return? Wouldn't the DataTable object need to
implement the ICloneable interface to perform a deep copy?
By contrast, how does this differ if I was using returning my own user
defined object instead the DataTable?
Thanks!
Andy