字典的序列化 [英] serialization of dictionary

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

问题描述

我有要存储在会话中的对象列表,我像这样声明它们:

I have lists of objects that I want to store in the session and I'm declaring them like this:

Dictionary<DateTime, List<MyObjects>> SessionMyObjects = new Dictionary<DateTime, List<MyObjects>>();

我正在阅读一些帖子,这些帖子表明字典不可序列化并且在会话中存储字典会导致错误.这是关于什么的?我正在使用 InProc;这种存储类型没有序列化吗?如果代码编译通过,我以后会不会因为使用这种结构而出现一些奇怪的错误?

I'm reading some posts that suggest that dictionaries are not serializable and storing dictionaries in the session will cause errors. What is this about? I'm using InProc; there's no serialization with this storage type? If the code compiles, could I still get some strange errors later because of using this structure?

推荐答案

Paul Welter 发表了一个很好的 SerializableDictionary.

Paul Welter published a good SerializableDictionary.

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

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