[Mono-list] Differences in GetHashCode() of Type between .NET and Mono
Edward Ned Harvey (mono)
edward.harvey.mono at clevertrove.com
Mon Dec 8 11:48:01 UTC 2014
> From: mono-list-bounces at lists.ximian.com [mailto:mono-list-
> bounces at lists.ximian.com] On Behalf Of Hüning, Christian
> I am using Mono alongside .NET in larger Deployments. Just recently I
> wanted to use GetHashCode() of the type of an object to start a little
> algorithm on each node, which needs to produce the same result when the
> same type's hashcode (or another equivalent information) is used.
> However I found that Mono and .NET produce different hashcodes for the
> same type from the same DLL. On second thought, this is very clear to me,
> since up to recently we could have no idea how the GetHashCode()
> implementation in .NET looks like.
You're not supposed to do that. And I don't understand what exactly you're trying to do.
You're trying to compare the types of two objects? Why don't you compare the types directly instead of using their hashcodes? Or use the type.Name, or use the string returned by type.ToString()?
More information about the Mono-list