Search code examples
xamarin.iosgethashcode

Does GetHashCode() work correctly in MonoTouch for NSObject-derived objects?


I'm trying to figure out if MonoTouch correctly calls the underlying "hash" message when you call GetHashCode() from a NSObject drived object. A quick check of the implementation of GetHashCode() (in MD's assembly browser) for an arbitrary object (NSAttributedString in my example) has it calling object.InternalGetHashCode(), so I suspect it doesn't call "hash". "hash" doesn't appear to be exposed either, which makes me suspect there's another way to get to it. Anyone been down this road before?


Solution

  • Good observation, this is a bug.

    I will fix this in MonoMac, and for our upcoming iPhone/.NET product