title: C# Linq to XML read multiple tags with attributes
body: <p>I am trying to read a XML file using Linq To XML but cannot seem to understand how to do it.</p>
  
  <p>I have this XML file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;Thing&gt;
      &lt;Objects&gt;
          &lt;MyTag name="" num="2"&gt;
              &lt;Date month="May" day="2" year="2006" /&gt;
          &lt;/MyTag&gt;
  
          &lt;MyTag name="" num="4"&gt;
              &lt;Date month="May" day="22" year="2012" /&gt;
          &lt;/MyTag&gt;
  
          &lt;MyTag name="" num="2"&gt;
              &lt;Date month="May" day="11" year="2034" /&gt;
          &lt;/MyTag&gt;
      &lt;/Objects&gt;
  &lt;/Thing&gt;
  </code></pre>
  
  <p>I started with this query:</p>
  
  <pre><code>// Load the xml
  XDocument document = XDocument.Load(XML_PATH);
  
  var query = from thing in document.Root.Descendants("Objects")
              select new
              {
                  TagName = thing.Attribute("name").Value.ToString(),
                  TagNum = thing.Attribute("num").Value.ToString(),
  
                  // What do I write here to get the Date tag and attributes?
              };
  </code></pre>
  
  <p>How would I get the the <code>Date</code> tag and attributes? Not sure how to get the next node. </p>
  
  <p>I tried to print out <code>TagName</code> and <code>TagNum</code> inside a <code>foreach</code> loop like this:</p>
  
  <pre><code>foreach(string value in query)
  {
      Console.WriteLine(value.TagName + " " + value.TagNum); 
  }
  </code></pre>
  
  <p>However, I am getting an error saying</p>
  
  <pre><code>CS0030  Cannot convert type '&lt;anonymous type: string TagName, string TagNum&gt;' to 'string'
  </code></pre>