I would like to be able to create a exact copy of a class object, in order to implement a rollback mechanism for that class. The idea is that the object can be rolled back to a previous version. At key points in time the object must be able to make a copy of itself and keep the copy in memory until needed.

The problem is that the class is complex, with a deep containment hierarchy. To complicate matters, some of these contained objects are instances of classes defined in other components.

I don't want to take the approach of creating a new object of the class and (recursively) copying each of the properties across, as this would be quite inefficient and actually impractical.

Is there any way to achieve this? Perhaps it is possible to use a memory block copy.

Cheers

Jonathan