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.
I am using hash tables for both database and new file in which key/value pairs are in the format -
("ABC,12","12,ABC")
The issue is that I am unable to perform hashtable comparison properly. For example, if my database file's hashtable has the following values-
("ABC,12","12,ABC")
("XYZ,Sample","Sample,XYZ")
and the new file has values
("ABC,12","12,ABC")
("ABC,20","20,ABC")
("XYZ,SAMPLE","SAMPLE,XYZ")
By using the following code
if (!_database.ContainsKey(KeyValueinNewFile)
I am getting the following output
("ABC,20","20,ABC")
("XYZ,SAMPLE","SAMPLE,XYZ")
It should only be
("ABC,20","20,ABC")
I have also used
Hashtable ht = System.Collections.Specialized.CollectionsUtil.CreateCaseInsensitiveHashtable();
and
Hashtable ht = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
but it is not working. Please suggest me something in which I do not have to make major changes in the application.