I have an object which I have created from an XML document using visual studio's xsd.exe. Is there a way to populate an instance of this object with the contents of an XML document without having to manually set each property/attribute?
For example:
XElement doc = XElement.Parse(docStr);
var results = from e in doc.Elements("myobj")
select new MyObj { prop1 = (string) e.Attribute("prop1") };
I've generated MyObj from the document itself, and setting every property within this document will be rather verbose when there's many of them. Is there some way to get Linq to work it out for itself?