With extension methods, we can write handy LINQ operators which solve generic problems.
I want to hear which methods or overloads you are missing in the System.Linq
namespace and how you implemented them.
Clean and elegant implementations, maybe using existing methods, are preferred.
AsIEnumerable
Usage:
EmptyIfNull
This is a controversial one; I am sure many purists will object to an "instance method" on
null
succeeding.Usage:
I'm surprised no one has mentioned the MoreLINQ project yet. It was started by Jon Skeet and has gained some developers along the way. From the project's page:
Take a look at the Operators Overview wiki page for a list of implemented operators.
It is certainly a good way to learn from some clean and elegant source code.
IsEmpty
Each
Nothing for the purists, but darn it's useful!
In and NotIn
C# equivalents of two other well-known SQL constructs