Case-Insensitive SortedList Keys

G

Guest

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
 
G

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
 

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