generics.net-3.5collectionsdictionarystringdictionary

StringDictionary vs Dictionary<string, string>


Does anyone have any idea what the practical differences are between the System.Collections.Specialized.StringDictionary object and System.Collections.Generic.Dictionary?

I've used them both in the past without much thought as to which would perform better, work better with Linq, or provide any other benefits.

Any thoughts or suggestions as to why I should use one over the other?


Solution

  • Dictionary<string, string> is a more modern approach. It implements IEnumerable<T> and it's more suited for LINQy stuff.

    StringDictionary is the old school way. It was there before generics days. I would use it only when interfacing with legacy code.