title: XML Serialization and null value - C#
body: <p>I have an object that I serialize to XML. If one of the properties in the object is null, then native serialization ignores to add this as the attribute. Is this normal behavior, if so, is there a way I can override it?</p>
  
  <p>ex:</p>
  
  <pre><code>public class Test
  {
    [XmlAttribute]
    public string value {set; get; }
  
    [XmlAttribute]
    public string key {set; get; }
  }
  </code></pre>
  
  <p>When value is null, i get</p>
  
  <pre><code>&lt;Root&gt;
    &lt;Test key="blah"&gt;
  &lt;/Root&gt;
  </code></pre>