I'm getting a xml file from one vendor that has some "empty" dates like this:
<UpdatedOn/>
<DeletedOn/>
By doing a regular deserialization it fails with:
Inner Exception: System.FormatException: String was not recognized as a valid DateTime.
Any ideas how to deal with this ?
My fields are already marked for a default DateTime
:
[System.Xml.Serialization.XmlElementAttribute(DataType="date")]
[System.ComponentModel.DefaultValueAttribute(typeof(System.DateTime), "1901-01-01")]
public System.DateTime UpdateOn{...}
See Question&Answers more detail:os