如何使用C#将字典对象序列化为XML文件 [英] How to serialize dictionary object to XML file using c#
本文介绍了如何使用C#将字典对象序列化为XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含所有值的字典对象.现在,我想将其序列化为xml文件.
I have a dictionary object with all the values. Now, I wanted to serialize it into an xml file.
由于xmlserializer不支持字典,因此我使用了datacontractserializer,并且我还通过使用来处理未知类型 DataContractResolver.
Since dictionary is not supported with xmlserializer, I have used datacontractserializer and i have also handled unknown types by using DataContractResolver.
这里的问题是,我得到的输出如下.
The issue here is, I am getting the output as below.
但是我需要生成如下输出:
But I need to generate the output as below:
Vis
推荐答案
WCF论坛
The WCF forums http://social.msdn.microsoft.com/Forums/en-US/wcf/threads is the better place for such questions
这篇关于如何使用C#将字典对象序列化为XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文