Serializable and [ICloneable]

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?


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


Thanks for the information there.

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


Doug Holland


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.