简体   繁体   中英

How is GetHashCode() implemented for Int32?

I've been looking all over the place, but I can't find anything. Can anyone shed some light on this?

According to Reflector:

public override int GetHashCode()
{
    return this;
}

Makes sense, does it?

Best way to hash 32 bit value to 32 bit is not to invent wheel, use value itself. Very fast, no collisions, indeed a perfect way.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM