This is my xml
<?xml version='1.0' encoding='utf-16'?>
<Message>
<FirstName>Hunt</FirstName>
<LastName>DAvid</LastName>
</Message>
This is my code...
string xml = File.ReadAllText("c:\\Message.xml");
var result = DeserializeFromXml<Message>(xml);
I was getting error..
Solution:
Message class is missing XmlRoot
[Serializable, XmlRoot("Message")]
public class Message
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
<?xml version='1.0' encoding='utf-16'?>
<Message>
<FirstName>Hunt</FirstName>
<LastName>DAvid</LastName>
</Message>
This is my code...
string xml = File.ReadAllText("c:\\Message.xml");
var result = DeserializeFromXml<Message>(xml);
I was getting error..
Solution:
Message class is missing XmlRoot
[Serializable, XmlRoot("Message")]
public class Message
{
public string FirstName { get; set; }
public string LastName { get; set; }
}