title: How to yield return inside anonymous methods?
body: <p>Basically I have an anonymous method that I use for my <code>BackgroundWorker</code>:</p>
  
  <pre><code>worker.DoWork += ( sender, e ) =&gt;
  {
      foreach ( var effect in GlobalGraph.Effects )
      {
          // Returns EffectResult
          yield return image.Apply (effect);
      }
  };
  </code></pre>
  
  <p>When I do this the compiler tells me:</p>
  
  <blockquote>
    <p>"The yield statement cannot be used
    inside an anonymous method or lambda
    expression"</p>
  </blockquote>
  
  <p>So in this case, what's the most elegant way to do this? Btw this DoWork method is inside a static method, in case that matters for the solution.</p>