C# - Cannot deserialize to string



I'm writing a method to deserialize from .xml file to object. I've got the inner exception that invalid string format to parse from string to Datetime at (7,6) in the xml file:



<Time>22/12/2014 21:07:44</Time>


However, there's no Datetime field in my class:



public string Time { get; set; }


Here's my code for deserializing:



var serializer = new XmlSerializer(typeof(Order));
Order order;
using (TextReader reader = new StreamReader(filePath))
{
order = (Order)serializer.Deserialize(reader);
}


I can't understand why the exception occurs...


No comments:

Post a Comment