title: How to implement GetHashCode for a pair of 3D vectors
body: <p>First of all, I found an implementation of GetHashCode for a 3D integer vector, but I can't figure out if this is a good one or not (at least I'm not 100% sure):</p>
  
  <pre><code>public struct Vector3i
  {
      public int x;
      public int y;
      public int z;
  
      public override int GetHashCode ()
      {
          return x.GetHashCode () ^ y.GetHashCode () &lt;&lt; 2 ^ z.GetHashCode () &gt;&gt; 2;
      }
  }
  </code></pre>
  
  <p>From this, I would like to create a pair of 3D vectors (let's call them A and B) with a hashcode which is independent from the order of Vectors A and B. In other words I want the pair (A, B) to have the same hashcode than the pair (B, A).
  I thought of something like this:</p>
  
  <pre><code>public struct Vector3iPair
  {
      public Vector3i a;
      public Vector3i b;
  
      public override int GetHashCode ()
      {
          return a.GetHashCode () ^ b.GetHashCode ();
      }
  }
  </code></pre>
  
  <p>Do you think this would have the correct behavior?</p>