0

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>>();

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?

frenchie
  • 51,731
  • 109
  • 304
  • 510

2 Answers2

2

Why isnt there an XMLSerializable dictionary in .NET?

Community
  • 1
  • 1
SwDevMan81
  • 48,814
  • 22
  • 151
  • 184
0

Paul Welter published a good SerializableDictionary.

Lloyd
  • 2,932
  • 2
  • 22
  • 18
  • If I'm using InProc session states, do I need to be concerned about serialization? – frenchie Jan 31 '11 at 18:31
  • InProc (in process) Session State does not Serialize the Session to persist it, where you will fail is when you or another developer changes the Session state in the config file. – Lloyd Jan 31 '11 at 18:53
  • There are only three things a programmer be sure of Death, Taxes and Requirements changes! – Lloyd Jan 31 '11 at 19:09
  • I love a good downvote with no comments! **Please comment when downvoting!!** – El Ronnoco Feb 04 '11 at 12:59