IDictionary到XML序列化 [英] IDictionary to XML serialization

查看:97
本文介绍了IDictionary到XML序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





有谁知道,如何将IDictionary Object(字符串,Object)序列化为XML?

Hi

Does any one knows , how to serialize IDictionary Object (of string,Object) to XML ?

推荐答案

你必须自己做,默认情况下不会实现。



此页面 [ ^ ],具体来说:



You''d have to do it yourself, it isn''t implemented by default.

See this page[^], specifically:

引用:

问:为什么我不能序列化哈希表?



答:XmlSerializer无法处理实现IDictionary接口的类。这部分是由于计划约束,部分原因是哈希表在XSD类型系统中没有对应物。唯一的解决方案是实现一个不实现IDictionary接口的自定义哈希表。

Q: Why can''t I serialize hashtables?

A: The XmlSerializer cannot process classes implementing the IDictionary interface. This was partly due to schedule constraints and partly due to the fact that a hashtable does not have a counterpart in the XSD type system. The only solution is to implement a custom hashtable that does not implement the IDictionary interface.


这篇关于IDictionary到XML序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆