Adding methods to IEnumerable means that all types that come from IEnumerable would have to implement them themselves. Now, using extension methods, we can sort the additions of implementations to interfaces.
Another side effect will be that code written in .NET 2.0 will still compile with 3.0 when Linq was introduced. Otherwise, if you implemented IEnumerable somewhere in your project, you would also have to implement all the new methods in the interface.
LINQ methods for Linq To Objects are defined in the Enumerable class.
In addition, LINQ looks for methods declared using specific syntax and is not an interface or class. You can find the Edulinq Jon Skeet series.
MSDN link to extension methods.
Bennym
source share