I am trying to serialize a class several of the data-members are Nullable objects, here is a example
[XmlAttribute("AccountExpirationDate")]
public Nullable<DateTime> AccountExpirationDate
{
get { return userPrincipal.AccountExpirationDate; }
set { userPrincipal.AccountExpirationDate = value; }
}
However at runtime I get the error
Cannot serialize member 'AccountExpirationDate' of type System.Nullable`1[System.DateTime]. XmlAttribute/XmlText cannot be used to encode complex types.
However I checked and Nullable is a SerializableAttribute. What am I doing wrong?
DateTime?
, which is synonymous withNullable<DateTime>
... – Substantive