What is the motivation behind "Use Extension Methods Sparingly?"
- by Robert Harvey
I find them a very natural way to extend existing classes, especially when you just need to "spot-weld" some functionality onto an existing class.
Microsoft says, "In general, we recommend that you implement extension methods sparingly and only when you have to." And yet extension methods form the foundation of Linq; in fact, Linq was the reason extension methods were created.
Are there specific design criteria where using extension methods are perferred over inheritance or composition? Under what criteria are they discouraged?