title: LINQ to XML, is there a better way to determine if an element exists in a list?
body: <p>I am working with LINQ to XML in VB (although answers in C# are great, too).  First off- my code works, so this is not critical.  However, I can't help but think that what I'm doing with conditional logic should already be doable using the LINQ query itself.</p>
  
  <p>Here's what I've got:</p>
  
  <pre><code>        'Get the Description elements in the ResultData section where the value is "Op Code"
          Dim opCodes As List(Of XElement) = (From c In xdoc.Descendants("ResultData").Descendants("Description")
                   Where c.Value = "Op Code"
                   Select c).ToList()
  
          If opCodes.Count &gt; 0 Then
              'Get the sibling XElement of the first "Description" XElement (there should be only one) by using the parent
              sOperator = Convert.ToString(((From c In opCodes
                       Select c).FirstOrDefault().Parent).&lt;Value&gt;.Value)
          Else
              sOperator = "Not Available"
          End If
  </code></pre>
  
  <p>Please don't be too critical of my method of locating the sibling nodes- the XML files are produced by a third-party testing device and this is the only generic way to get the values I need.  What I'm really looking for here is a better way to handle the If block.</p>
  
  <p>Any thoughts offered on this will be greatly appreciated.</p>