I don't think the automatic serialization will be able to handle the SortedList type.
The XML serializer normally works by creating an instance of the class, then using reflection to set all its public fields and properties. It also has some special logic to understand types that implement the ICollection interface, and use the Add method to read the collection items.
This doesn't work for dictionary types, though (and SortedList is just a specific implementation of IDictionary). Dictionaries are a collection of KeyValuePair<K,V>, but KeyValuePair doesn't have any parameterless constructor, so it is not possible for the serializer to construct instances of this type.
For this reason, the standard .NET XmlSerializer doesn't support dictionaries at all. Our content pipeline serializer
does one better than that and knows how to automatically serialize the standard Dictionary<K,V> class, but it still doesn't understand other dictionary implementations such as SortedList.
The easiest thing here would be to use a regular dictionary instead of SortedList.
If you absolutely need to make this work, you can implement a custom ContentTypeSerializer which will manually tell the pipeline how to read and write this type to XML (ContentTypeSerializer is how you customize the behavior for types that can't be handled properly by the default reflection based serialization). To learn how to do this, use Reflector to look at our built in DictionarySerializer implementation.
--
XNA Framework Developer
blog -
homepage