C#, override Equals() & operator==, list<obj>.contains will not return true.
I have a class where I have overridden "==" and "Equals()", which does work to return true when comparing two different IntVector2's with identical values.
However, I try using it as a Key in a dictionary, and it will not return anything, so I have to use the following code to get the object reference I want.
IntVector2 iv = new IntVector2(x, y); foreach(IntVector2 iv2 in this.HeightMap.Keys) { if(iv2 == iv) { iv = iv2; break; } }
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.