01-13-2021 06:52 PM
G# clone method doesn't clone Class member if Class member is a class.
01-14-2021 12:41 AM
Yes, it would not be to hard to implement support for a deep clone. G# already has methods for traversing attributes generic, but yet no method to update and replace an aggregated object. I do think it would be possible to add reverse functionality to do that generic. I put that on the "wishlist".
Meanwhile, you can always add a DeepClone method to your class that traverse thought your hierarchy and call "DeepClone" on your aggregated objects (you need to implement a DeepClone method in all class that is part of the clone hierarchy). It would look like something like this:
I attach an example where I deep clone a one-level hierarchy, but it could be transfered to any depth.
Best regards,
Mattias Ericsson
ADDQ
01-14-2021 08:39 AM