title: How to parse XML attribute (string) to (int) during the LINQ query
body: <p>I've got a class:</p>
  
  <pre><code>public class Layout
  {
      public int Width { get; set; }
      public int Height { get; set; }
  }
  </code></pre>
  
  <p>How do I read the XML attribute and assign it to int from the class above in the following LINQ query:</p>
  
  <pre><code>var layouts =
      from elem in layoutSummary.Descendants("Layout")
      select new Layout
      {
          // Width = elem.Attribute("Width").Value,  // Invalid cast string to int)
          // Int32.TryParse((string)elem.Attribute("Height").Value, Height) // Doesn't assign Height value to Layout.Height
      };
  </code></pre>