title: Struct implicit vs empty constructor
body: <p>Considering the following struct :</p>
  
  <pre><code>    struct S
      {
          public string s;
      }
  </code></pre>
  
  <p>What is the difference between 1 : </p>
  
  <pre><code>    S instance = new S();
      instance.s = "foo";
  </code></pre>
  
  <p>and 2 :</p>
  
  <pre><code>    S instance;
      instance.s = "foo";
  </code></pre>
  
  <p>Both versions compile and run fine.<br>
  I am just curious to know what happens behind the scenes.
  <br><br><strong>Edit :</strong> <br>
  I guess in case 2 S is unassigned until we put a value on its s field;<br>
  As this doesn't work :</p>
  
  <pre><code> S instance;
   if (inst.s == null)
       inst.s = "foo";  //Compiler drops : Use of possibly unassigned field 's'
  </code></pre>
  
  <p>while this does :</p>
  
  <pre><code> S instance;
   inst.s = "foo";
   if (inst.s == null)
       inst.s = "bar";  //Compiler drops : Use of possibly unassigned field 's'
  </code></pre>
  
  <p>and this also works : </p>
  
  <pre><code> S inst = new S();     
   if (inst.s == null)
        inst.s = "foo";
  </code></pre>
  
  <p>I welcome any deeper explanations about this behavior       </p>
  
  <p><strong>Update</strong><br> 
  I found those 2 posts, completing Marc's answer : <br>
  <a href="https://stackoverflow.com/questions/441309/why-are-mutable-structs-evil">why are mutable structs evil</a><br>
  <a href="https://stackoverflow.com/questions/521298/when-to-use-struct-in-c/6973171#6973171">when to use struct in c#</a><br></p>