title: How can I XML Serialize a DateTimeOffset Property?
body: <p>The <code>DateTimeOffset</code> property I have in this class doesn't get rendered when the data is represented as Xml. What do I need to do to tell the Xml serialization to render that proper as a <code>DateTime</code> or <code>DateTimeOffset</code>?</p>
  
  <pre><code>[XmlRoot("playersConnected")]
  public class PlayersConnectedViewData
  {
      [XmlElement("playerConnected")]
      public PlayersConnectedItem[] playersConnected { get; set; }
  }
  
  [XmlRoot("playersConnected")]
  public class PlayersConnectedItem
  {
      public string name { get; set; }
      public DateTimeOffset connectedOn { get; set; }  // &lt;-- This property fails.
      public string server { get; set; }
      public string gameType { get; set; }
  }
  </code></pre>
  
  <p>and some sample data...</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;playersConnected 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;playerConnected&gt;
      &lt;name&gt;jollyroger1000&lt;/name&gt;
      &lt;connectedOn /&gt;
      &lt;server&gt;log1&lt;/server&gt;
      &lt;gameType&gt;Battlefield 2&lt;/gameType&gt;
    &lt;/playerConnected&gt;
  &lt;/playersConnected&gt;
  </code></pre>
  
  <h3>Update</h3>
  
  <p>I'm hoping there might be a way through an Attribute which I can decorate on the property...</p>
  
  <h3>Bonus Question</h3>
  
  <p>Any way to get rid of those two namespaces declared in the root node? Should I?</p>