Why does StringDictionary.Add use case-insensitive keys?

K

Kyle Blaney

In the remarks for the StringDictionary.Add method it states that "The
key is handled in a case-insensitive manner; it is translated to lower
case before it is added to the string dictionary."

Why is that done for StringDictionary.Add but not for the Add methods
in other similar classes like Hashtable? Is there any way to override
that behaviour and use StringDictionary with case-sensitive keys?

Kyle Blaney
 
J

Joe Delekto

Greets,

It's done for StringDictionary because it was designed as a specialized
collection. If you look at the rotor source code for the StringDictionary
class, they indeed use ToLower() on the key before adding or removing to the
collection. You could easily take this source and modify it to remove the
ToLower() calls.

Regards,

Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top