title: Can you eval or equivalent in linq?
body: <p>If i had a list of question numbers</p>
  
  <pre><code>var questions =  new List&lt;int&gt; { 2, 4, 8 };
  </code></pre>
  
  <p>Is it possible to have a query that does something like this in linq?</p>
  
  <pre><code>var results = new List&lt;Answer&gt;();
  
  foreach (var qNum in questions)
  {
     results.AddRange(Answers.Where(x =&gt; eval(x.Question+qNum) == "Yes"));
  }
  </code></pre>
  
  <p>So this would look up the answer for x.Question2, x.Question4 and x.Question8.</p>
  
  <h2>Addendum</h2>
  
  <p>Currently i am doing this:</p>
  
  <pre><code>    var questionAnswers = new List&lt;Answer&gt;();
  var Q2 = Questions.Where (x =&gt; x.MainQ2.ToUpper() == "NO")
      .Select(x =&gt; new Answer { QuestionNumber = 2, AnswerText = x.MainTextQ2, User_Id = x.User_Id });
  
  var Q4 = Questions.Where (x =&gt; x.MainQ4.ToUpper() == "NO")
      .Select(x =&gt; new Answer { QuestionNumber = 4, AnswerText = x.MainTextQ4, User_Id = x.User_Id });
  
  var Q8 = Questions.Where (x =&gt; x.MainQ8.ToUpper() == "NO")
      .Select(x =&gt; new Answer { QuestionNumber = 8, AnswerText = x.MainTextQ8, User_Id = x.User_Id });
  
  questionAnswers.AddRange(Q2);
  questionAnswers.AddRange(Q4);
  questionAnswers.AddRange(Q8);
  
  questionAnswers.GroupBy (a =&gt; a.QuestionNumber).Dump();
  
  
  public class Answer
  {
      public int QuestionNumber {get;set;}
      public string AnswerText {get;set;}
      public string User_Id {get;set;}
  }
  </code></pre>
  
  <p>Many thanks :)</p>