I've got a typed DataSet with multiple tables that I want copy, complete with data as well as schema. I can access the tables like so in my original:
MyDataSetType dsMyFirstDataSet;
MyDataTableType dtTable1;
MyDataTableType dtTable2;
dtTable1 = dsMyFirstDataSet.MeaningfulTableName1;
dtTable2 = dsMyFirstDataSet.MeaningfulTableName2;
When I do the following, I can no longer access the tables via the names in the new version but I can via the Tables collection.
MyDataSetType dsMySecondDataSet;
dsMySecondDataSet = dsMyFirstDataSet.Copy();
dtTable1 = dsMySecondDataSet.MeaningfulTableName1; // null
dtTable2 = dsMySecondDataSet.MeaningfulTableName2; // null
dtTable1 = dsMySecondDataSet.Tables[0]; // table not null/copied ok
dtTable2 = dsMySecondDataSet.Tables[1]; // table not null/copied ok
I'm currently accessing them via the index like the second example but I'm wondering why the named table link has been severed? Do I have to write my own Copy() method to preserve the named access to the tables?