views:

277

answers:

2

I am trying to XML-serialize a nested class. Both classes have dictionaries which I am serializing using this link.

Serialization works fine but the nested class doesn't get de-serialized. Can you please let me know how to do it?

A: 

XML Serialization does not serialize nested classes. It only serializes member fields/properties of a class. If you want to serialize a nested class, you should have a field of the nested class type in the parent class.

logicnp
A: 

Implement IXmlSerializable on the class that you need to serialize. It's a bit of extra work, but it provides a much nicer way to control XML output for your classes.

If you do this, serializing a dictionary should not be a issue.

Thanks for suggestion.Actually my custom Dictionary serialization was wrong. I corrected it according to the list I have in question and now its working fine.
Cool