title: Xml serialization - Hide null values
body: <p>When using a standard .NET Xml Serializer, is there any way I can hide all null values? The below is an example of the output of my class. I don't want to output the nullable integers if they are set to null.</p>
  
  <p>Current Xml output:</p>
  
  
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;myClass&gt;
     &lt;myNullableInt p2:nil="true" xmlns:p2="http://www.w3.org/2001/XMLSchema-instance" /&gt;
     &lt;myOtherInt&gt;-1&lt;/myOtherInt&gt;
  &lt;/myClass&gt;
  </code></pre>
  
  <p>What I want:</p>
  
  
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;myClass&gt;
     &lt;myOtherInt&gt;-1&lt;/myOtherInt&gt;
  &lt;/myClass&gt;
  </code></pre>