Closer examination revealed that the properties not getting serialized were 'read-only' properties; i.e. they had getters but no setters. The default XML Serializer in .NET calls the property getters/setters and hence if a read-only property is present, then it is not serialized.
Once we added setters to the properties, XML serialization worked fine.
There is another option. We can implement the IXmlSerializable interface and write custom serialization code. But this could be very tedious.
No comments:
Post a Comment