Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XML Serialization
Message
From
06/11/2006 06:19:00
 
 
To
All
General information
Forum:
ASP.NET
Category:
XML
Title:
XML Serialization
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01167278
Message ID:
01167278
Views:
49
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
Next
Reply
Map
View

Click here to load this message in the networking platform