Skip to content

Streaming vs buffering operators

Context: Streaming operators yield results one by one as they iterate over the source. Buffering operators consume the entire source before producing any result.

Where, Select, Take, Skip, SelectMany (they process elements on‑the‑fly).

var streaming = numbers.Where(n => n > 2); // yields one by one

OrderBy, GroupBy, Distinct, Reverse (need all data to work).

var buffered = numbers.OrderBy(n => n); // reads all numbers first

Large data sets: Use streaming operators to avoid loading everything into memory. Avoid OrderBy on huge collections unless necessary.

Example: In System.Reactive (Rx.NET), streaming operators are used for infinite sequences.