Back to serialization again this is a beast that just wont die every time I think I know everything about serialization that there is to know about I get whacked over the head with it. One of the big issues with xml serialization is that it will not serialize a dictionary if you try you get an error like this
Cannot serialize member SSD.SourceControl.Modules.Files.Monitors.Business.MonitorSettings.Accesses of type System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=220.127.116.11, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b77a5c561934e089]], because it implements IDictionary.
You have four ways to deal with this
- Do not use a dictionary
- Override the dictionary and implement IXmlSerializable (http://weblogs.asp.net/pwelter34/archive/2006/05/03/444961.aspx)
- Use binary serialization
- Use JSON Serialization
Personally my preference is to either user binary serialization or JSON serialization if that is an option.