I have a class named Class1 I override its Equals function Now I have an instance of Dictionary And I added an instance of Class1 named OBJ1 to it. I have another instance of Class1 named OBJ2. the code returns true for OBJ1.Equals(OBJ2). But I can't find OBJ2 in dictionary.
Here is pseudo code
Class1 OBJ1 = new Class1(x, y, z);
Class1 OBJ2 = new Class1(a, b, c);
Dictionary<Class1, int> dic1 = new Dictionary<Class1, int>();
dic1.Add(OBJ1, 3);
OBJ1.Equals(OBJ2) -------------> return true
Dictionary.ContainsKey(OBJ2) --------------> return false
why is this happening? any help would be highly welcomed