algorithm - C# hashcode for array of ints -


I have a class that is internal only an array of integers, once the array is never built. I want to pre-calculate a good hashode so that this class can be used as a key in a dictionary very effectively. The length of the array is less than 30 objects, and the integers are normal between -1000 and 1000.

Not very smart, but adequate for most practical purposes:

< Em> Edit: Thank you for this, thanks to Henk Holterman's comment.

  int hc = array.Length; For (int i = 0; i  

If you need some more sophisticated, then


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -