can I use the string.GetHashCode(开发者_Python百科)
function for storing stemming data reliably?
You can use string.GetHashCode to balance a hash table. That's all it is designed to be used for, and that's all it should be used for.
In particular, the documentation specifically states that you should under no circumstances persist hashcodes to permanent storage; the string hash code algorithm is permitted to change at any time, and in fact has done so in the past.
From MSDN at Object.GetHashCode Method
The default implementation of the GetHashCode method does not guarantee unique return values for different objects. Furthermore, the .NET Framework does not guarantee the default implementation of the GetHashCode method, and the value it returns will be the same between different versions of the .NET Framework. Consequently, the default implementation of this method must not be used as a unique object identifier for hashing purposes.
精彩评论