title: Linq Elements Attribute string list
body: <p>I'm new to Linq and have a problem too get a list of a specific attribute of an element.</p>
  
  <p>The XML file looks like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;configuration&gt;
    &lt;logGroup&gt;
      &lt;group name="cpm Log 1h 1y Avg" logInterval="* 1 * * * ?" /&gt;
      &lt;group name="cpm Log 1d 2y Avg" logInterval="* 10 * * * ?" /&gt;
    &lt;/logGroup&gt;
    &lt;tagGroup&gt;
      &lt;tag name="Tag_1"&gt;
        &lt;property name="VALUE"&gt;
          &lt;logGroup name="cpm Log 1h 1y Avg" /&gt;
          &lt;logGroup name="cpm Log 1d 2y Avg" /&gt;
        &lt;/property&gt;
      &lt;/tag&gt;
      &lt;tag name="Tag_2"&gt;
        &lt;property name="VALUE"&gt;
          &lt;logGroup name="cpm Log 1h 1y Avg" /&gt;
          &lt;logGroup name="cpm Log 1d 2y Avg" /&gt;
        &lt;/property&gt;
      &lt;/tag&gt;
      &lt;tag name="Tag_3"&gt;
        &lt;property name="VALUE"&gt;
          &lt;logGroup name="cpm Log 1h 1y Avg" /&gt;
          &lt;logGroup name="cpm Log 1d 2y Avg" /&gt;
        &lt;/property&gt;
      &lt;/tag&gt;
    &lt;/tagGroup&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I want for get a list of an specific Tag. </p>
  
  <p>So to the TAG_1 this list should be like: </p>
  
  <pre>
  "cpm Log 1h 1y Avg"
  "cpm Log 1d 2y Avg"
  </pre>
  
  <p>I have tried with this code: </p>
  
  <pre><code>var tagLogGroups =
      from logGroupName in xelement
          .Elements("tagGroup")
          .Elements("tag")
          .Elements("property")
          .Elements("logGroup")
      where (string)logGroupName.Element("tag") == "Tag_1"
      select logGroupName.Attribute("name").Value;
  </code></pre>