in C#, when should we use abstract classes instead of interfaces with extension methods?

Technology CommunityCategory: C#in C#, when should we use abstract classes instead of interfaces with extension methods?
VietMX Staff asked 3 years ago
  • Abstract classes work by inheritance. Being just special base classes, they model some is-a-relationship.
  • Interfaces on the other hand are a different story. They don’t use inheritance but provide polymorphism (which can be implemented with inheritance too). They don’t model an is-a relationship, but more of a it does support.

Applying extension methods to an interface is useful for applying common behaviour across classes that may share only a common interface.