Hashtable可以序列化吗? [英] Can Hashtable be Serialized and How ?

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

问题描述

哈希表可以序列化吗?如何序列化?请有人向我解释一下.....

解决方案

找到了^ ] ,就在此处与Google一起在代码项目上进行.

我倾向于创建一个具有属性KeyValue的小类,然后在序列化过程中将我的哈希表复制到该小类的通用List中.然后序列化列表,并在我的哈希表上设置XmlIgnore.在反序列化过程中,我当然必须倒退.

写这个,我发现很明显我也应该实现我自己的可序列化哈希表,因为我已经多次写了copy-to-generic-List:/


Can Hashtable be Serialized and How ? please someone explain me about this.....

解决方案

Found this[^], right here on code project, with google.


No a Hashtable can''t be serialized, and Google will list a multiple different ways in making a serializable Hashtable-class.

I tend to make a small class with the properties Key and Value, then during serialization copy my hashtable to a generic List of my small class. And serialize the list, and setting XmlIgnore on my hashtable. During deserialization I have to do it backwards of course.

Writing this, I find it obvious that I should also just implement my own serializable hashtable, since I''ve written the copy-to-generic-List multiple times :/


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

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