Home All Groups Group Topic Archive Search About

Case-Insensitive SortedList Keys

Author
9 Jun 2006 4:25 PM
Alex Maghen
Boy, the documentation for creating a SortedList whose text-based key will be
case-insensitive is impossible for me to understand.

I want to create a SortedList where the KEY for every element will always be
a String and where a lookup on that SortedList (SL["Xyz"]) will be
case-insensitive. Can someone please just tell me what to shove into the
Constructor to make that happen?

Thanks!

Alex

Author
9 Jun 2006 7:22 PM
GhostInAK
Hello Alex,

You can either write your own Comparer... or what I usually prefer to do
is just add all the keys lowercase:  tList.Add(tKey.ToLower, tObject)

-Boo

Show quote
> Boy, the documentation for creating a SortedList whose text-based key
> will be case-insensitive is impossible for me to understand.
>
> I want to create a SortedList where the KEY for every element will
> always be a String and where a lookup on that SortedList (SL["Xyz"])
> will be case-insensitive. Can someone please just tell me what to
> shove into the Constructor to make that happen?
>
> Thanks!
>
> Alex
>

AddThis Social Bookmark Button