On May 02, 2006, at 3:44 PM, Mark O'Neill wrote:
Hi Gerard,
On 2 May 2006, at 22:39, Dr Gerard Hammond wrote:
Yes, you will need to deep clone the entire structure.
I've tried:
redim MyCancelArray(-1)
for each MC as MyClass in MyActualArray
MyCancelArray.Append MC
next
But that has the same problem.
This simply makes a new array that has a new bunch of references to
the same instances.
You'd need something like
redim MyCancelArray(-1)
for each MC as MyClass in MyActualArray
MyCancelArray.Append new myClass(MC) /// this assumes you have a
COPY CONSTRUCTOR that makes a new myClass from an existing one
next
Basically myClass would need to have a constructor that looks like
Constructor(existingInstance as myClass)
me.property = existingInstance.property
// and so on for ALL other properties in myClass
This literally makes a copy
Personally I tend to like the ability to have an object keep track of
the changes and then I can just keep one set of objects and ask each
one if it had any changes made. This makes for fewer objects and
copies and also makes it easy to figure out if anything changed.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>