C# arraylist can't compare objects after they are loaded from disk
- by Zka
To make it easy, lets say I have an arraylist allBooks containing class "books" and an arraylist someBooks containing some but not all of the "books".
Using contains() method worked fine when I wanted to see if a book from one arraylist was also contained in another.
The problem was that this isn't working anymore when I save both of the Arraylists to a .bin file and load them back once the program restarts. Doing the same test as before, the contains() returns false even if the compared objects are the same (have the same info inside).
I solved it by overloading the equals method and it works fine, but I want to know why did this happen?