开发者

XML Serialization of nested classes having Dictionary

I am trying to XML-serialize a nested class. Both classes have dictionaries which I am serializing using this li开发者_开发问答nk.

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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜