title: Automatically populating an object using Linq to XML
body: <p>I have an object which I have created from an XML document using visual studio's <code>xsd.exe</code>.  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?</p>
  
  <p>For example:</p>
  
  <pre><code>XElement doc = XElement.Parse(docStr);
  var results = from e in doc.Elements("myobj")
                select new MyObj { prop1 = (string) e.Attribute("prop1") };
  </code></pre>
  
  <p>I've generated <code>MyObj</code> 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?</p>