title: Why is using [DataMember(EmitDefaultValue = false)] not recommended?
body: <p>In WCF you can define a contract using the <code>[DataContract]</code> and <code>[DataMember]</code> attributes, like this:</p>
  
  <pre><code>[DataContract]
  public class Sample 
  {
      [DataMember(EmitDefaultValue = false, IsRequired = false)]
      public string Test { get; set; }
  }
  </code></pre>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/aa347792.aspx" rel="noreferrer" title="MSDN">This article on the MSDN</a> states that using <code>EmitDefaultValue = false</code> is not recommended:</p>
  
  <p><img src="https://i.stack.imgur.com/CLhKU.png" alt="snippet"></p>
  
  <p>However, i like to use this, because the XML that is generated using this construction is cleaner. Not specifying this setting results in:</p>
  
  <pre><code>&lt;Sample&gt;
      &lt;Test xsi:nil="true"/&gt;
  &lt;/Sample&gt;
  </code></pre>
  
  <p>while using the setting the element  is ommited when there is no value:</p>
  
  <pre><code>&lt;Sample&gt;
  &lt;/Sample&gt;
  </code></pre>
  
  <p>I'm curious to what the reasoning behind that statement is. Specifically since both snipptes of XML look equivalent to me (and both last part can be deserialized correctly for this contract).</p>
  
  <p><strong>What is the reasoning behind this statement?</strong></p>