StringDictionary will lower your keys (and your expectations)
I needed to store a collection of key/value strings, so I turned to a familiar class I've used in the past: System.Collections.Specialized.StringDictionary. It's pretty straightforward to use, you construct it, then add your items one at a time. However, I ran into some pretty odd behavior where all the keys I injected came back out lower cased.. and subsequently, blew up into a nice error screen because some of the underlining code was dependant on specifically cased key strings.
According to microsoft:
The key is handled in a case-insensitive manner; it is translated to lowercase before it is used with the string dictionary.
WTF? There doesn't seem to be any way around it. And I don't see any overloads (StringDictionary has just an empty ctor) or properties to set to override this behavior.. so I may need to find another solution. Microsoft should at least give the developer the option to control how the keys, or values are normalized.
Update: as I was about to submit this entry, I found this blog entry from haack boy. I've resorted to using Dictionary<string, string>.

0 Comments