If there is a similar, very proud, if reproduced, please specify
In C #, with hashtable,datatable and so on replication and cloning, the following directly see examples
HashTable ht = NULL;
HT = new HashTable ();
foreach (string s in HT)
{
//...
}
It is necessary to modify the key values in the Hashtable when the above is traversed, it is common to report the exception, prompting your collection to modify XXX or something, because the collection in the back of the Foreach loop cannot be changed.
This time should I think of, should be in the traversal before copying a copy,
HashTable ht2 = new HashTable ();
Ht. Copy (ht2,0);
The above code can be debugged through, but the problem comes again, when I modified the ht2 in the key value, found that the key in HT also modified, obviously this is not the result I want, and then slightly thinking, with the Clone ()
Problem solving,
(DataTable also, datatable DT2 = dt.) Copy () or directly to the value is not possible, the same will change the value in the original datatble, ... Not to be continued ...
In C #, using hashtable,datatable and so on to copy and clone