N
Nick
Hi all,
I am using GetHashCode on unique strings to get a unique integer for a
string that I can then place into a database (use int rather than the
string to make indexing faster). The problem is that the hashcode can
change depending ion the clr version, from msdn
'The behavior of GetHashCode is dependent on its implementation, which
might change from one version of the common language runtime to
another. A reason why this might happen is to improve the performance
of GetHashCode. If you require the behavior of GetHashCode be
constant, override the runtime implementation of GetHashCode with an
implementation of your own that you know will never change.'
Does any one have the code so that I can overide gethashcode for my
string object so that my hashcode will remain constant even in the
future or can anyone suggest a better way of getting a unique int for
unquie strings.
Thanks,
Nick
I am using GetHashCode on unique strings to get a unique integer for a
string that I can then place into a database (use int rather than the
string to make indexing faster). The problem is that the hashcode can
change depending ion the clr version, from msdn
'The behavior of GetHashCode is dependent on its implementation, which
might change from one version of the common language runtime to
another. A reason why this might happen is to improve the performance
of GetHashCode. If you require the behavior of GetHashCode be
constant, override the runtime implementation of GetHashCode with an
implementation of your own that you know will never change.'
Does any one have the code so that I can overide gethashcode for my
string object so that my hashcode will remain constant even in the
future or can anyone suggest a better way of getting a unique int for
unquie strings.
Thanks,
Nick