title: How to select column names using a lambda expression?
body: <p>I am very new to lambda expressions.</p>
  
  <p>I have this xml</p>
  
  <pre><code>&lt;Booksshel&gt;
     &lt;BookN&gt;
         &lt;column&gt;author&lt;/column&gt;
         &lt;column&gt;Price&lt;/column&gt;
         &lt;column&gt;Date&lt;/column&gt;
     &lt;/BookN&gt;
     &lt;BookDetails id=1&gt;
         &lt;author&gt;john&lt;/author&gt;
         &lt;price&gt;50&lt;/price&gt;
     &lt;/BookDetails&gt;
     &lt;BookDetails id=2&gt;
         &lt;author&gt;kalam&lt;/author&gt;
         &lt;price&gt;90&lt;/price&gt;
     &lt;/BookDetails&gt;
     &lt;BookDetails id=3&gt;
         &lt;author&gt;sachin&lt;/author&gt;
         &lt;price&gt;70&lt;/price&gt;
         &lt;Date&gt;12-08-2015&lt;/Date&gt;
     &lt;/BookDetails&gt;
  &lt;/Booksshel&gt;
  </code></pre>
  
  <p>In the above XML I have column names in a list 'author, price' that I need to select the particular <code>BookDetails</code> using a lambda expression.</p>
  
  <pre><code>foreach (var col in columnName)
  {
      sl.AddRange(_doc.Descendants("BookDetails")
            .Where(p =&gt;Id.Contains(p.Element("BookDetails").Value))
            .Select(p=&gt; New { p.Element(col).Value }).ToList())
  }
  </code></pre>
  
  <p>This is raising some strange issues. How can I get the details?</p>