We have the following code in production and it is being used in JSON serialization/deserialization (serialized lists of SomeType in files on hard drive):
public sealed class Cultures : List<Culture>
{
}
The requirements have changed in a way that we would benefit greatly if we had it implemented like Dictionary<string, Culture> because than we get key/value functionality (Culture class has a property ID of type string which would be used as a key). Staying with List we have to do this manually.
What’s the best (or only, if any) way to go to Cultures : Dictionary but keep serialization working even with those files that already have a List of Cultures serialized in them?
Implement the interface IDictionary on your Cultures class. You can use it as a dictionary, but all serialization works as before.