I am working with a huge XML using a tool in VS2010 able to convert it into a Model (.cs class). Now in order to read that XML, I am parsing through the tags and filling in my objects in the Model. Just want to know if I am on the right track or there's a easier way to now load the Model with xml data
Asked
Active
Viewed 72 times
1 Answers
2
You can use the XmlSerializer
class to do this for you.
using(StreamReader reader = File.OpenText("FilePath"))
{
XmlSerializer serial = new XmlSerializer(typeof(MyModel));
MyModel model = serial.Deserialize(reader);
}

ywm
- 1,107
- 10
- 14
-
It's `XmlSerializer` - you've mis-spelled it every time you've used it. – Matt Hogan-Jones Jan 28 '14 at 10:43
-
-