Source Generators
Source generators comprise our first big category of standard query operators. Although different source objects can be LINQ-enabled (for example, by implementing IEnumerable<T> for local query execution or by implementing IQueryable<T> for remote query execution; for example, as used in LINQ to SQL), it sometimes makes sense to create a sequence on-the-fly.
All the methods discussed here live on the Enumerable type and provide a means to generate a source without persisting it in memory, thanks to lazy evaluation. Obviously, you can also use array, lists, or other collection types as in-memory data sources, but with immediate memory-allocation needs.
Range
The first source generator is called Range and produces Int32 values ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access