title: Compare HashTable Keys in C# case-insensitively
body: <p>I have two files, database file and a new file which I have to compare. The values which are not present in the database file but are in the new file are processed further. </p>
  
  <p>I am using hash tables for both database and new file in which key/value pairs are in the format -</p>
  
  <pre><code>("ABC,12","12,ABC")
  </code></pre>
  
  <p>The issue is that I am unable to perform hashtable comparison properly. For example, if my database file's hashtable has the following values-</p>
  
  <pre><code>("ABC,12","12,ABC")
  ("XYZ,Sample","Sample,XYZ")
  </code></pre>
  
  <p>and the new file has values</p>
  
  <pre><code>("ABC,12","12,ABC")
  ("ABC,20","20,ABC")
  ("XYZ,SAMPLE","SAMPLE,XYZ")
  </code></pre>
  
  <p>By using the following code </p>
  
  <pre><code>if (!_database.ContainsKey(KeyValueinNewFile)
  </code></pre>
  
  <p>I am getting the following output</p>
  
  <pre><code>("ABC,20","20,ABC")
  ("XYZ,SAMPLE","SAMPLE,XYZ")
  </code></pre>
  
  <p>It should only be</p>
  
  <pre><code> ("ABC,20","20,ABC")
  </code></pre>
  
  <p>I have also used </p>
  
  <pre><code>Hashtable ht = System.Collections.Specialized.CollectionsUtil.CreateCaseInsensitiveHashtable();
  </code></pre>
  
  <p>and </p>
  
  <pre><code>Hashtable ht = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
  </code></pre>
  
  <p>but it is not working. 
  Please suggest me something in which I do not have to make major changes in the application. </p>