title: Xdocument get subelemnts attributes with Linq
body: <p>I have XML as below which I am loading into XDocument</p>
  
  <pre><code>&lt;ConversionSpecification xmlns="http://tempuri.org/X12ParserSpecification.xsd" TransactionSetIdentifierCode="837"&gt;
    &lt;Loop LoopId="1000A" Name="SNAME" Identifier="NM1*41"&gt;  
      &lt;Segment SegmentId="NM1" Usage="R"/&gt;  
      &lt;Segment SegmentId="PER" Usage="R"/&gt;  
    &lt;/Loop&gt;  
    &lt;Loop LoopId="1000B" Name="RNAME" Identifier="NM1*40"&gt;
      &lt;Segment SegmentId="NM1" Usage="R"/&gt;  
    &lt;/Loop&gt;  
    &lt;Loop LoopId="2000B" Name="SHLOOP" Identifier="22"&gt;      
      &lt;Segment SegmentId="SBR" Usage="R"/&gt;  
      &lt;Segment SegmentId="PAT" Usage="S"/&gt;  
    &lt;/Loop&gt;  
  &lt;/ConversionSpecification&gt; 
  
  
  
  XDocument document = XDocument.Load("Files/Loops.xml"); 
  XNamespace ns = XNamespace.Get("http://tempuri.org/X12ParserSpecification.xsd");
  
  var loopInfo = from loop in document.Descendants(ns + "Loop")
                 select new Loop
                 {
                    LoopID = loop.Attribute("LoopId").Value,
                    LoopIdentifier = loop.Attribute("Identifier").Value
                    LoopSegments = 
                    LoopUsage =  
                 };
  </code></pre>
  
  <p>Where Loop is:</p>
  
  <pre><code> class Loop    
   {  
       public string LoopID { get; set; }  
       public string LoopIdentifier { get; set; }  
       public string[] LoopSegments { get; set; }          
       public string[] LoopUsage { get; set; }  
   }  
  </code></pre>
  
  <p>Now I would like to assign LoopElements with SegmentID attribute values and LoopUsage with usage attribute values. Is there a way to do it with a single subquery?</p>