title: What is the yield keyword used for in C#?
body: <p>In the <a href="https://stackoverflow.com/questions/39447/how-can-i-expose-only-a-fragment-of-ilist">How Can I Expose Only a Fragment of IList&lt;></a> question one of the answers had the following code snippet:</p>
  
  <pre><code>IEnumerable&lt;object&gt; FilteredList()
  {
      foreach(object item in FullList)
      {
          if(IsItemInPartialList(item))
              yield return item;
      }
  }
  </code></pre>
  
  <p>What does the yield keyword do there?  I've seen it referenced in a couple places, and one other question, but I haven't quite figured out what it actually does.  I'm used to thinking of yield in the sense of one thread yielding to another, but that doesn't seem relevant here.</p>