title: GetHashCode() with string keys
body: <p>Hey all, I've been reading up on the best way to implement the GetHashCode() override for objects in .NET, and most answers I run across involve somehow munging numbers together from members that are numeric types to come up with a method.  Problem is, I have an object that uses an alphanumeric string as its key, and I'm wondering if there's something fundamentally wrong with just using an internal ID for objects with strings as keys, something like the following?</p>
  
  <pre><code>
  // Override GetHashCode() to return a permanent, unique identifier for
  // this object.
  static private int m_next_hash_id = 1;
  private int m_hash_code = 0;
  public override int GetHashCode() {
    if (this.m_hash_code == 0)
      this.m_hash_code = &lt;<i>type</i>&gt;.m_next_hash_id++;
    return this.m_hash_code;
  }
  </code></pre>
  
  <p>Is there a better way to come up with a unique hash code for an object that uses an alphanumeric string as its key?  (And no, the numeric parts of the alphanumeric string isn't unique; some of these strings don't actually have numbers in them at all.)  Any thoughts would be appreciated!</p>