Last post Nov 04, 2010 03:02 PM by kylemac
Oct 08, 2010 01:25 PM|kylemac|LINK
i have an object and I'm trying to clone it:
p = Master.ActiveProduct
v = p.variations(rblVariations.SelectedIndex)
v.id = 0
When I get to this point, the "cloned" variation is added to the collection, but it also changes the original variations values to the new cloned values as well.
The variation object has a "New" Constructor.
I've been scratching my head on this all morning trying.
What am I doing wrong?
Oct 13, 2010 05:16 AM|Wencui Qian - MSFT|LINK
Actually, object v is a reference to the original object. Thus, the modification to v will reflect to the original value. If you want a total new object with the same values, you need to "copy" the values, which means to assign the same values to the new
Nov 04, 2010 03:02 PM|kylemac|LINK
FYI. I made it ICloneable and invoked the .Clone() method.