title: Why should I not implement Equals and GetHashCode using reflection?
body: <p>I have some objects with a bunch of fields and I find myself having to implement GetHashCode and Equals.  It is painful to go though each field manually so I wrote them like this:</p>
  
  <pre><code>public override int GetHashCode()
  {
      int hash = 17;
      foreach (PropertyInfo p in GetType().GetProperties())
      {
          hash = hash * 23 + p.GetValue(this, null).GetHashCode();
      }
      return hash;
  }
  
  public override bool Equals(object obj)
  {
      foreach (PropertyInfo p in GetType().GetProperties())
      {
          if (p.GetValue(obj, null) != p.GetValue(this, null))
              return false;
      }
      return true;
  }
  </code></pre>
  
  <p>Other than speed considerations why shouldn't I implement them like this?  </p>