A* Pathfinding Project

Incorrect implementation of Equals overrides


#1

I have an unrelated system which uses reflection to go through objects and puts them in a HashSet where some types from the A* Pathfinding Project cause InvalidCastExceptions when it tries to compare them to objects of different types. This could be avoided by a proper implementation of any Equals overrides.

For structs, it should start with if (!(obj is StructName)) return false; which includes a null check.

For classes, it should generally start with var casted = obj as ClassName; if (casted == null) return;


#2

Hi

Which particular classes are you referring to?


#3

Almost everything that overrides Equals: Connection, Int2, Int3, IntRect

Guid is the only one implemented correctly.


#4

Thanks!
I have fixed this in my dev version now.