title: Using conditional operator in lambda expression in ForEach() on a generic List?
body: <p>Is it not allowed to have a conditional operator in a lambda expression in ForEach?  </p>
  
  <pre><code>List&lt;string&gt; items = new List&lt;string&gt;{"Item 1", "Item 2", "Item I Care About"};
  
  string whatICareAbout = "";
  
  // doesn't compile :(
  items.ForEach(item =&gt; item.Contains("I Care About") ? 
  whatICareAbout += item + "," : whatICareAbout += "");
  </code></pre>
  
  <p>Compilation error -> "Only assignment, call, increment, decrement, and new object expressions can be used as a statement"</p>
  
  <p>Trying to use a normal if doesn't work either:</p>
  
  <pre><code>// :(
  items.ForEach(item =&gt; if (item.Contains("I Care About")) {whatICareAbout += item + ", ";}
  </code></pre>
  
  <p>Just not possible?</p>