title: Define a condition in a loop, without add an if
body: <p>I have a loop that is going through each element of a list.</p>
  
  <p>At the moment I have the foreach loop, and inisde, an if that check a variable for the element of the list. If the value is true, I do certain activities, otherwise I move on.</p>
  
  <p>I was wondering if there is some sort of construct, that would allow me to write something like </p>
  
  <pre><code>foreach (myclass item in itemlist) where ( item.is_red)
  {
       ... do something
  }
  </code></pre>
  
  <p>instead than what I have currently</p>
  
  <pre><code>foreach (myclass item in itemlist)
  {
      if (item.is_red)
          ... do something
  }
  </code></pre>
  
  <p>From what I recall, the "where" can be used only as constant definition mechanism, like when defining a specific type of class; so it can't be used in the context that I am presenting here. Am I stuck with the if-else inside the loop as only solution?</p>