Extension methods are useful for types that you don't own and can't/don't want to derive from and extend (e.g. reference types and interfaces).
Obviously, interfaces should be kept as short and to-the-point as possible, so extension methods for interfaces are particularly useful (e.g. LINQ).
For classes, especially classes that you own, they're still useful - but I'm wondering how you determine what should be an extension method or what should be a method in the class itself.
Personally, every time I think about it, I keep going round in circles with the following thoughts:
- If it's useful enough, it should be in the class.
- It's not part of the core responsibility of the class, it should be an extension method - but if it's useful enough, surely it should be the responsibility of the class...
What do you think?