The documentation comes from the Markdown files in the source code, so is always up-to-date but available only in English. Enjoy!
ExtensionMethods are a nice feature added in C# 3.0 that allow us to 'pretend' that a method is an instance method of an object where really it's defined in a static class outside of the type. This small difference can make a huge step forward in readability:
Code with Linq query like this:
var query2 = people
.Where(p => p.Age > 20)
.OrderByDescending(p => p.Age)
.ThenBy(p => p.Name));
will look like this without extension methods:
var query2 = Enumerable.ThenBy(
Enumerable.OrderBy(
Enumerable.Where(
people,
p => p.Age > 20),
p => p.Age),
p => p.Name):
because all these methods are not implemented over
IEnumerable<T>
.
This language feature has become so useful that many utility projects have grown around the concept, an active question about this.
It looks like everybody wants to make an 'standard' set of extension methods, and in the way they introduce a new library, making the problem bigger.
So, why bother doing a new one?
© Signum Software. All Rights Reserved.
Powered by Signum Framework