Erik Meijer is fond of pointing out that every LINQ function could actually be implemented by SelectMany; everything else is just a convenience.
This is what Eric Lippert says answering a question about monads, but I've heard Erik Meijer say this in other videos about LINQ and Rx. (Simply put, Erik Meijer is the guy who created LINQ and Rx)
I wonder how you would implement some of the most used LINQ functions with SelectMany? Ignore perfromance for now, let's focus on elegance and succinctness.
- Where
- Select
- First
- Take(n)
- TakeWhile
- GroupBy
- OrderBy
- Zip
- Others...