title: Why does the source code for the Guid constructor contain the line "this = Guid.Empty"?
body: <p>If you look a the source code for the constructor of <code>Guid(string)</code> <a href="http://referencesource.microsoft.com/#mscorlib/system/guid.cs,4329442fa037af5c" rel="noreferrer">in the .NET 4.5.2 source code</a> it is as follows:</p>
  
  <pre><code>public Guid(String g)
  {
      if (g==null) {
          throw new ArgumentNullException("g");
      }
      Contract.EndContractBlock();
      this = Guid.Empty;
  
      GuidResult result = new GuidResult();
      result.Init(GuidParseThrowStyle.All);
      if (TryParseGuid(g, GuidStyles.Any, ref result)) {
          this = result.parsedGuid;
      }
      else {
          throw result.GetGuidParseException();
      }
  }
  </code></pre>
  
  <p>The question is what is the purpose of the line <code>this = Guid.Empty;</code>?</p>
  
  <p>From what I can see if <code>string g</code> can successfully be parsed in the <code>TryParseGuid</code> method then <code>this</code> will be assigned. If it can't then an exception will be thrown.</p>
  
  <p>Suppose you wrote:</p>
  
  <pre><code>var guid = new Guid("invalidguid");
  </code></pre>
  
  <p>This would cause an exception and the value of guid would be undefined I would assume. So why the need to assign <code>this</code> to <code>Guid.Empty</code>?</p>