title: Can asmx services return nothing instead of null?
body: <p>I have a WebService I'm maintaining, running on .Net 2.0. It uses the original "asmx" file standard for a series of web services. In these web services, some objects are returned that have potentially a large number of "null" values. For example:</p>
  
  <pre><code>&lt;user id="1" name="foo" job="null" location="null" audience="null" /&gt;
  </code></pre>
  
  <p>This is a simple example; in reality, we have a lot more "null" values. Since I don't really need to have the nulls because I can easily infer that they're null from their non-existence, I'd prefer to not return them at all. Can this be done? If so, how?</p>
  
  <p>Edited to add class definition:</p>
  
  <pre><code>[Serializable]
  public partial class User
  
      [XmlAttribute("Id")]
      public int Id 
      {
          get { return GetColumnValue&lt;int&gt;("ID"); }
  
          set { SetColumnValue("ID", value); }
  
      }
  
  
  
      [XmlAttribute("Username")]
      public string Username 
      {
          get { return GetColumnValue&lt;string&gt;("Username"); }
  
          set { SetColumnValue("Username", value); }
  
      }
  }
  </code></pre>
  
  <p>By the way, what I'm aiming to see is:</p>
  
  <pre><code>&lt;user id="1" name="foo" /&gt;
  </code></pre>