title: c# exit generic ForEach that use lambda
body: <p>Does anyone know if it is possible to exit a generic ForEach that uses lambda? e.g.</p>
  
  <pre><code>someList.ForEach(sl =&gt;
    {
      if (sl.ToString() == "foo")
          break;
  
      // continue processing sl here
      // some processing code
    }
  );
  </code></pre>
  
  <p>This code itself won't compile. I know I could use a regular foreach but for consistency I want to use lambda. </p>
  
  <p>Many thanks.</p>