I have a dictionary datamember that I am trying to serialize and get the following error
{"Cannot serialize member InstrumentUI.Tallie.UserSpecificData of type System.Collections.Generic.Dictionary`2[[System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[InstrumentUI.Tallie+UserTally, InstrumentUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], because it implements IDictionary."}
Does this mean that you cannot serialize the dictionary data member. And if so is there antoher container that I could use. I need a data member that can store a byte[] as the key and hold another datamember that stores a string as the key and an in for the value. any ideas. I was using the dictionary like this
dictionary<byte [] , dictionary <string, int> >.
Anything here would be very helpful. Thanks, Matt

Dictionary container serialization problems.
INTPnerd
ti_m
What I ended up doing is converting it to a public list of key value paits value by value. I had problems deserialising the list though so I converted the list to array's. It was not to hard and it seemed to fit the best for the situation. I think it is silly though that the dictionary data member is not serializable. Why isn't it It doesn't seem like it would be that dificult to impliment the functionality into the serialize functions. Maybe someone could explain to me why it can't be serialized.
If anyone is interested on the code that was used to convert the dictionary to key pair lists and then to array's let me know and I'll see what I can scrounge up.
Noorul Ahmed
Does anybody know of an example of this code written in vb.net
Thank you
friendz
Brad Mittelstedt
http://weblogs.asp.net/pwelter34/archive/2006/05/03/444961.aspx
Rumen Filkov
Jamie LJ
ravi_nilesh
This question has come up a few times on internal discussion threads recently so I wanted to summarize some highlights. It's correct that you get this error because Dictionary isn't IXmlSerializable. The reason it's this way is layering concerns: Dictionary is in mscorlib.dll but IXmlSerializable is in System.Xml.dll, and we couldn't take a dependency in that direction.
Before .NET 3.0 you'd have to grow your own solution, such as subclassing Dictionary to implement IXmlSerializable. Moving forward, the recommended solution is to use System.Runtime.Serialization.DataContractSerializer. Note that this is part of the Windows Communication Foundation (WCF), in .NET 3.0. For more details on what is serializable using the data contract serializer, see: http://msdn2.microsoft.com/en-us/library/ms731923.aspx
Paul Fuhrmann
kilo94