I can't seem to "disconnect " a "rebuilt" ArrayList of objects from it's source AL; I thought I understood the rules on copying AL Data objects vs. the "clone" Method (and it's simply being a reference to the original ArrayList). The code looks like:
[code=cpp]
ArrayList alTemp1 = new ArrayList();
ArrayList alTemp2 = (ArrayList)Sess ion["AStandingSessi onAL"];
for (int i = 0; i < alTemp2.Count; i++) {
alTemp1.Add((cl sAnObject)alTem p2[i]);
((clsAnObject)a lTemp1[i]).Price = 46.00;
}
[/code]
This code will change the "Price" to 46.00 for all objects in the ORIGINAL ArrayList (Session["AStandingSessi onAL"]). I thought that if you created a new AL and did "Add" from another AL, this would "disconnect " or "Deep Copy" the AL??
Thanks...
[code=cpp]
ArrayList alTemp1 = new ArrayList();
ArrayList alTemp2 = (ArrayList)Sess ion["AStandingSessi onAL"];
for (int i = 0; i < alTemp2.Count; i++) {
alTemp1.Add((cl sAnObject)alTem p2[i]);
((clsAnObject)a lTemp1[i]).Price = 46.00;
}
[/code]
This code will change the "Price" to 46.00 for all objects in the ORIGINAL ArrayList (Session["AStandingSessi onAL"]). I thought that if you created a new AL and did "Add" from another AL, this would "disconnect " or "Deep Copy" the AL??
Thanks...
Comment