I know it's a known issue, and the solution is to change ptoperty type to string. I would hate to do that and hopefully someone knows a workaround. Trying to derserialize an XML to a class that has a nullable DateTime property. It's all good when the xml doesn't contain a corresponding element, the problem comes when the element is there but empty - getting a deserialization error. The sample is below, thanks in advance!
Code:
XML:
<address>
<streetAddress>1914 DEHESA</streetAddress>
<city>EL CAJON</city>
<state>CA</state>
<postalCode>92019</postalCode>
[b]<dateReported>1998-04-20</dateReported>[/b]
</address>
[code]
[code]
C#:
....
private DateTime? dateReported;
[XmlElement("dateReported", IsNullable=true)]
public DateTime? DateReported
{
get { return dateReported; }
set { dateReported = value; }
}
...
}