title: GetHashCode Extension Method
body: <p>After reading all the questions and answers on StackOverflow concerning overriding <code>GetHashCode()</code> I wrote the following extension method for easy and convenient overriding of <code>GetHashCode()</code>:</p>
  
  <pre><code>public static class ObjectExtensions
  {
      private const int _seedPrimeNumber = 691;
      private const int _fieldPrimeNumber = 397;
      public static int GetHashCodeFromFields(this object obj, params object[] fields) {
          unchecked { //unchecked to prevent throwing overflow exception
              int hashCode = _seedPrimeNumber;
              for (int i = 0; i &lt; fields.Length; i++)
                  if (fields[i] != null)
                      hashCode *= _fieldPrimeNumber + fields[i].GetHashCode();
              return hashCode;
          }
      }
  }
  </code></pre>
  
  <p>(I basically only refactored the code that someone posted there, because I really like that it can be used generally)</p>
  
  <p>which I use like this:</p>
  
  <pre><code>    public override int GetHashCode() {
          return this.GetHashCodeFromFields(field1, field2, field3);
      }
  </code></pre>
  
  <p>Do you see any problems with this code?</p>