title: How to execute LINQ and/or foreach in Immediate Window in VS 2013?
body: <p>Immediate Window is fantastically useful tools when probing the current state during debugging process. I learned that by using the question mark, one can do a bit more in there as shown <a href="https://stackoverflow.com/questions/32934635/execute-method-from-immediate-window">in this post</a>.</p>
  
  <p>However, I still don't know how to execute LINQ queries there (<strong>including</strong> lambda expressions). I've also failed to execute a <em>foreach</em> statement.</p>
  
  <p>When executing the following statements:</p>
  
  <pre><code>?(things.Select(thing=&gt;thing.Id);)
  ?(foreach(var thing in things);)
  </code></pre>
  
  <p>I'm getting these errors:</p>
  
  <blockquote>
    <p>Expression cannot contain lambda expressions<br>
    Invalid expression term 'foreach'</p>
  </blockquote>
  
  <p>(How) can I execute these in the Immediate Window?</p>
  
  <p>There's also a tool in <a href="https://visualstudiogallery.msdn.microsoft.com/4ABCDAC4-AFFE-4AE8-822C-B662264DEA65" rel="noreferrer">VS Gallery</a> but it's said that it only works for VS05 and VS08, which most programmers have left behind looong time ago. I'm looking for something applicable to VS13 and/or VS15.</p>