title: Will Guid.GetHashCode() return different value with different AppDomain?
body: <p>According to MSDN: <a href="http://msdn.microsoft.com/en-us/library/system.string.gethashcode%28v=vs.110%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.string.gethashcode%28v=vs.110%29.aspx</a>,</p>
  
  <p>String.GetHashCode() for identical strings can differ because of:</p>
  
  <ol>
  <li><p>Different versions of .NET Framework.</p></li>
  <li><p>Different platforms (such as 32-bit and 64-bit).</p></li>
  <li><p>Or even different application domains.</p></li>
  </ol>
  
  <p>How about Guid.GetHashCode()? Will it change in above 3 situations?</p>
  
  <p>I have checked that for 2, Guid.GetHashCode() does return different values.</p>
  
  <h2>Update</h2>
  
  <p>How to understand 3 regarding String.GetHashCode()? Suppose I run the same application twice, there are definitely 2 different application domains. But as I tried, the hash code are the always same as long as the target platform doesn't change. For example, "hello, world".GetHashCode(). </p>
  
  <p><strong>So when could 3 happen?</strong></p>
  
  <p>And here is some of my problem context:</p>
  
  <p>My server application receives some GUIDs from clients. The GUID is unique for each client. I want to distribute the client to different buckets. And I need to <strong>keep the client-bucket mapping fixed</strong>. There are many clients so I cannot keep all the seen clients in memory.</p>
  
  <p>My current solution is:</p>
  
  <ol>
  <li>Get the hash code of the client GUID (GUID or GUID string, not decided yet).</li>
  <li>Use the (HashCode % bucket total number) as the bucket index.</li>
  </ol>
  
  <p>I have to make sure the hash code stay fixed for a specific client.</p>