为什么XML Serializer不会序列化私有成员? [英] Why XML Serializer does not serialize private members?
本文介绍了为什么XML Serializer不会序列化私有成员?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我正在尝试使用XML序列化程序序列化一个对象,以便向后兼容dll,因为BinaryFormatter对此没有帮助。
但是我看到XML序列化程序没有序列化类的私有成员。为什么将此约束应用于XML序列化程序?
执行此操作的另一种方法是什么? [除二进制格式化程序]
提前谢谢!
Navnath
解决方案
您可以实现IXmlSerializable接口。示例
here 显示序列化私有字段
Hello,
I am trying to serialize an object using XML serializer for backward compatibility of dll because BinaryFormatter is not helping me for this.
But I see that XML serializer does not serialize the private members of class. Why this constraint is applied to XML serializer?
What is the other way to do this? [Except Binary Formatter]
Thank you in advance!
Navnath
解决方案
You can implement the IXmlSerializable interface. The example here shows it serializing a private field
这篇关于为什么XML Serializer不会序列化私有成员?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文