I'm trying to find out the best methods for Deserializing XML.
The main problem I've come across is if I have the following example.
DateTime _SomeTime;
[XmlElement("some-time")]
public DateTime CancelledAt
{
get { return _SomeTime; }
set { _SomeTime = value; }
}
Usually this is fine and serializes correctly however when it's null which from the feed I am dealing with it can be, am I better off just serializing it as String the converting it in to Datetime OR is there something else I can do to stop it throwing when attempting to deserialize.
Is it just safer to Deserialize everything to string then convert to it's proper type, or is there a better way?
Any help/advice would be much appreciated.