G#

cancel
Showing results for 
Search instead for 
Did you mean: 

Can G# add a method like python deepcopy?

 G# clone method doesn't clone Class member if Class  member is a class.

0 Kudos
Message 1 of 3
(85 Views)

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:

 

Mattias_Ericsson_0-1610606312032.png

 

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

 

Message 2 of 3
(65 Views)

thanks,but i don't know how to realize goal,i hope it will be realize next version,

0 Kudos
Message 3 of 3
(45 Views)