>Hi,
>
>I'm confused about XML serialization in .NET2.
>
>Firstly it appears that, unlike binary serialization, the IXMLSerialize interface doesn't have to be implemented for an object to be serialized.
>
>Secondly, I don't understand how it is determined which properties are serialized. As an example : I attempted to serialize a Windows.Forms.TreeNode. The serializer threw an exception for the ContextMenu, ContextMenuStrip and NodeFont properties. Fair enough; I added XMLIgnore attributes for these three and the serializer ran fine. But only the BackColor, ForeColor, Nodes, Text and Name properties were serialized. Although the BackColor and ForeColor elements are generated they're always empty thus rendering them rather pointless. The Nodes element DOES contain elements for nested nodes (and recurses through the whole tree correctly).
>
>So why are are the BackColor and ForeColor properties being written?
>Why, if the Nodes collection can be serialized successfully aren't, for example, the FirstNode, NextNode properties serialized also?
>
>And why are other properties (e.g. FullPath) omitted altogether?
>
>Regards,
>Viv
Viv,
I can't answer for certain except that the properties might be excluded in the base class, or the TreeNode type might have a custom serializer that ignores those properties.
AFAIK serialization has not changed between 1.x & 2.0. So the only thing that gets serialized are public properties and fields.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only