What Advantages of Extension Methods have you found? [closed]

The only advantage of extension methods is code readability. That’s it.

Extension methods allow you to do this:

foo.bar();

instead of this:

Util.bar(foo);

Now there are a lot of things in C# that are like this. In other words there are many features in C# that seem trivial and don’t have great benefit in and of themselves. However once you begin combining these features together you begin to see something just a bit bigger than the sum of its parts. LINQ benefits greatly from extension methods as LINQ queries would be almost unreadable without them. LINQ would be possible without extension methods, but not practical.

Extension methods are a lot like C#’s partial classes. By themselves they are not very helpful and seem trivial. But when you start working with a class that needs generated code, partial classes start to make a lot more sense.

Leave a Comment