title: GUID comparison weirdness
body: <p>.NET has two GUID data types: <a href="http://msdn.microsoft.com/en-us/library/system.guid%28v=vs.110%29.aspx" rel="nofollow">Guid</a>, which orders GUIDs in the "natural" way, and <a href="http://msdn.microsoft.com/en-us/library/system.data.sqltypes.sqlguid(v=vs.110).aspx" rel="nofollow">SqlGuid</a>, which considers the six bytes after the final dash to be most significant. This difference is explained in detail here: <a href="http://msdn.microsoft.com/en-us/library/ms254976(v=vs.110).aspx" rel="nofollow">MSDN: Comparing GUID and uniqueidentifier Values</a>.</p>
  
  <p>However, in both cases, the following should hold (assuming that all <code>...</code>s are equal):</p>
  
  <pre><code>57d0affe-... &lt; 57d0afff-... &lt; 57d0b000-...
  </code></pre>
  
  <p>If that is the case, why do I get the following output (see comments)?</p>
  
  <pre><code>using System;
  using System.Data.SqlTypes;
  
  class Program
  {
      static void Main(string[] args)
      {
          var g1 = new SqlGuid("57d0affe-9d9d-11e4-bec2-e840f2ad1632");
          var g2 = new SqlGuid("57d0afff-9d9d-11e4-bec2-e840f2ad1632");
          var g3 = new SqlGuid("57d0b000-9d9d-11e4-bec2-e840f2ad1632");
  
          Console.WriteLine(g1 &lt; g2); // prints True
          Console.WriteLine(g2 &lt; g3); // prints False &lt;- ?
          Console.ReadLine();
      }
  }
  </code></pre>
  
  <p>It is my understanding that <code>g2 &lt; g3</code> should yield True as well. Did I misunderstand something or is this some bug in the framework? When using plain <code>Guid</code> instead of <code>SqlGuid</code>, the output is twice <code>True</code>, as expected.</p>