Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 201247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:10:57+00:00 2026-05-11T17:10:57+00:00

Wondering if this is possible. We have an 3rd Party library that contains identification

  • 0

Wondering if this is possible.

We have an 3rd Party library that contains identification information about users…

The main interaction with the library is through a HashTable which is keyed with a string, and returns an Object Graph of information for that key.

The problem is, the key is obviously Case Sensitive, but what we get from the users browser doesn’t necessarily match the case… (We often get the key fully lowercase’d)

I’m wondering if it’s possible to do a case Insensitive key search against a hashtable.

e.g.

Hashtable ht = new Hashtable();
ht.Add("MyKey", "Details");

string result = ht["MyKey"];
string result = ht["MYKEY"];
string result = ht["mykey"];

On the off chance we could submit a support ticket to the company to add this functionality, are there any other DataStructures (i.e. the new generic collections/dictionaries) that support this functionality

Lastly, would it be possible to override the System.String GetHashCode() method, to
make all case invariant strings return the same hashcode… e.g. I’m thinking this is a no goer as string is a sealed class

Cheers if anyone has any suggestions

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T17:10:57+00:00Added an answer on May 11, 2026 at 5:10 pm

    Code to make the hashtable comparisons case-insensitive

    For 2.0, 3.0, 3.5

    Hashtable ht = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
    

    You can get info on InvariantCultureIgnoreCase vs. OrdinalIgnoreCase on this SO link

    OR

    Hashtable ht = System.Collections.Specialized.CollectionsUtil.CreateCaseInsensitiveHashtable();
    

    Because case-insensitive dictionary collection is such a common use, the .NET Framework has a CollectionUtil class that supports creating Hashtable and SortedList objects that are case insensitive. Use by calling CreateCaseInsensitiveHashtable or CreateCaseInsensitiveSortedList.

    For .Net 1.0 (I am not sure if 1.0 supports StringComparer)

    public class InsensitiveComparer : IEqualityComparer
    {
        CaseInsensitiveComparer _comparer = new CaseInsensitiveComparer();
        public int GetHashCode(object obj)
        {
            return obj.ToString().ToLowerInvariant().GetHashCode();
        }
    
        public new bool Equals(object x, object y)
        {
            if (_comparer.Compare(x, y) == 0)
            {
                return true;
            }
    
            else
           {
               return false;
           }
        }
    }
    
    Hashtable dehash = new Hashtable(new InsensitiveComparer());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if this was possible... I have a sequence of variables that
I was just wondering if this is possible. I have a site that admins
I was wondering if this were possible. I have a very complicated script, that
Hey guys, just wondering if this one is possible I have an app that
I was wondering if this was possible, and if so how I'd go about
i'm wondering about this possibility. Is it possible to make our code written in
i'm working on gcc , i'm wondering if this is possible: I have a
Wondering if this is possible, I have a java applet which I am embedding
Hi I was wondering if this is possible, this is my scenario, I have
I was wondering if there's a .NET library or a 3rd party tool for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.