title: Dynamic select query in LINQ
body: <p>I am in need to join two data tables and retrieve some columns(which will chosen dynamically) from the joined table. I have used the LINQ query to perform joins but i was not able to select columns columns dynamically.</p>
  
  <p>The code is:</p>
  
  <pre><code>    var q = (from pd in tableOne.AsEnumerable()
                   join od in tableTwo.AsEnumerable() on pd.Field&lt;string&gt;(leftTableColumn) equals od.Field&lt;string&gt;(rightTableColumn)
                   select new
                   {
                       Column1=pd.Field&lt;dynamic&gt;(reuiredColumn1),
                       Column2=od.Field&lt;dynamic&gt;(requireColumn2)
  
                   });
  </code></pre>
  
  <p>here tableOne and tableTwo are Data Tables. The problem here is I can always able to get only two columns(column1,column2) as per the query.But i am in need to form the select query dynamically based on the user selection.</p>
  
  <p>Can anyone please share any idea regards how to achieve this result?</p>