title: How do I find an XML element by attribute using LINQ to XML?
body: <p>I'm learning LINQ to XML and need to find the existence of an element with a particular attribute. At the moment I'm using:</p>
  
  <pre><code>XElement groupCollectionXml = XElement.Parse(groupCollection.Xml);
  IEnumerable&lt;XElement&gt; groupFind =
      from vw in groupCollectionXml.Elements("Group")
      where (string) vw.Attribute("Name") == groupName
      select vw;
  
  if (groupFind.Count() == 0)
      return false;
  else
      return true;
  </code></pre>
  
  <p>I know there is a more concise way of doing this, probably using Any(), but I'm not sure how to rewrite the query to use it. Does anyone have some good advice? Thanks.</p>