title: How does a streaming operator differ from deferred execution?
body: <p>In LINQ <code>Where</code> is a streaming operator.  Where-as <code>OrderByDescending</code> is a non-streaming operator.  AFAIK, a streaming operator only gathers the next item that is necessary.  A non-streaming operator evaluates the entire data stream at once. </p>
  
  <p>I fail to see the relevance of defining a Streaming Operator.  To me, it is redundant with Deferred Execution.  Take the example where I have written a custom extension and consumed it using the where operator and and orderby.</p>
  
  <pre><code>public static class ExtensionStuff
  {
      public static IEnumerable&lt;int&gt; Where(this IEnumerable&lt;int&gt; sequence, Func&lt;int, bool&gt; predicate)
      {
          foreach (int i in sequence)
          {
              if (predicate(i))
              {
                  yield return i;
              }
          }
      }
  }
  
      public static void Main()
      {
          TestLinq3();
      }
  
      private static void TestLinq3()
      {
          int[] items = { 1, 2, 3,4 };
  
          var selected = items.Where(i =&gt; i &lt; 3)
                              .OrderByDescending(i =&gt; i);
  
          Write(selected);
      }
  
  
  
      private static void Write(IEnumerable&lt;int&gt; selected)
      {
          foreach(var i in selected)
              Console.WriteLine(i);
      }
  </code></pre>
  
  <p>In either case, <code>Where</code> needs to evaluate each element in order to determine which elements meet the condition.  The fact that it yields seems to only become relevant because the operator gains deferred execution.  </p>
  
  <p>So, what is the importance of Streaming Operators?</p>