I have two hashsets that are loading data from two different text files. The contents of both text files look as follows:
name/12441431252132
name1/323244231244142
name2/32423452524234
My code to currently load both files and make sure i only have unique results from textFile2:
HashSet<string> txt1 = new HashSet<string>(File.ReadLines("textFile1.txt"));
HashSet<string> txt2 = new HashSet<string>(File.ReadLines("textFile2.txt"));
txt2.ExceptWith(txt1);
My problem is that it only removes lines based on the criteria if the whole line matches. I want to remove It based on the name basis instead. For example, name2 should never be included if its in textFile1 even if the id's after the / are different.
How would i accomplish this?
Let me know if my explanation is not good i will try to improve it - and please excuse my english!