title: Serializing a Nullable<DateTime> in to XML
body: <p>I am trying to serialize a class several of the data-members are Nullable objects, here is a example</p>
  <pre><code>[XmlAttribute(&quot;AccountExpirationDate&quot;)]
  public Nullable&lt;DateTime&gt; AccountExpirationDate 
  { 
    get { return userPrincipal.AccountExpirationDate; } 
    set { userPrincipal.AccountExpirationDate = value; } 
  }
  </code></pre>
  <p>However at runtime I get the error</p>
  <blockquote>
  <p>Cannot serialize member 'AccountExpirationDate' of type System.Nullable`1[System.DateTime]. XmlAttribute/XmlText cannot be used to encode complex types.</p>
  </blockquote>
  <p>However I checked and Nullable is a <a href="http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx" rel="nofollow noreferrer">SerializableAttribute</a>. What am I doing wrong?</p>