A contractor where I work is using extension methods
to implement CRUD
on well-known internal classes that we own. I say it is better
How do extension methods work under-the-hood?
They're just static methods; the compiler rewrites calls like myObject.MyExtensionMethod()
to MyExtensionClass.MyExtensionMethod(myObject)
.
Is it better to use inheretance or extension methods on WELL-KNOWN classes that you OWN?
There's not single answer to this question, it all depends on the context. But usually extension methods are most useful in those cases:
IEnumerable
and Linq extension methods)