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 yo开发者_StackOverflowu 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?
Good observation, this is a bug.
I will fix this in MonoMac, and for our upcoming iPhone/.NET product
object.InternalGetHashCode()
... is returned in Assembly Browser for System.Object as well, regardless if it is a MonoTouch or Mono project.
Yes, it works correctly.
精彩评论