I have a class with some data members (int, string, bool, Point).
These data members have public properties {get; set;}.
In my code I create an instance of this class using the default constructor.
So my Object’s data members have values of 0, string.Empty, false, {0,0} respectively.
How do I initialize these values of the field data
from an XML file, using LINQ to XML
without creating a new instance of the object.
I just want to read in the XML, and set the values of my Object.
It’s pretty easy using Linq to XML. Here’s a contrived example, it gets a little tougher if the document is longer and you need to validate the input, but the basic idea is the same