Serializable and [ICloneable]


#1
Hey Roman
Sounds great.
In that case can you make a minor change to the Document class that would ease this usage pattern.
Ideally either the Document class should be marked with the [Serializable] custom attribute, and any other types that the Document references, or easier than that (for us at least) could you implement the ICloneable interface?

#2

I don’t think we are going to make Document or other classes [Serializable] unless we find a good reason for it. Document can be save (read serialized) into DOC format at the moment and WordML and RTF will also be supported “serialization” formats later on.

All nodes provide the public Clone method already (derived from Node.Clone). We don’t explicitly implement the ICloneable interface because of some interesting guidelines I find in the MSDN blogs http://blogs.msdn.com/brada/archive/2003/04/09/49935.aspx


#3

Thanks for the information there.

Does the Node.Clone() method do a deep or shallow copy?

Regards,

Doug Holland


#4

http://www.aspose.com/Products/Aspose.Word/Api/Aspose.Word.Document.Clone_overload_1.html

Our Clone always creates a complete duplicate (deep clone) of the original node.

Note the boolean parameter isDeep - it controls whether to clone the child nodes, not the “shallowness or deepness”. So you always receive a deep clone, but it can be with or without its children. I shall probably rename isDeep into isCloneChildren later to avoid this confusion.