Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 203059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:20:42+00:00 2026-05-11T17:20:42+00:00

Is an interface + extension methods (mixin) preferable to an abstract class? If your

  • 0

Is an interface + extension methods (mixin) preferable to an abstract class?

If your answer is “it depends”, what does it depend upon?

I see two possible advantages to the interface + extension approach.

  • Interfaces are multiply inheritable and classes are not.
  • You can use extension methods to extend interfaces in a non-breaking way. (Clients that implement your interface will gain your new base implementation but still be able to override it.)

I have not yet thought of a downside to this approach. There may be a glaringly simple reason that the interface + extension approach will fail.

Two helpful articles on this topic are

  • Create Mixins with Interfaces and Extension Methods
  • Abstract Base Classes Have Versioning Problems Too
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T17:20:42+00:00Added an answer on May 11, 2026 at 5:20 pm

    Downside of extension methods: clients pre-C#3/VB9 won’t be able to use it as easily.

    That’s about it as far as I’m concerned – I think the interface-based approach is significantly nicer. You can then mock out your dependencies nicely, and everything is basically less tightly coupled. I’m not a huge fan of class inheritance unless it’s really about specialization 🙂

    EDIT: I’ve just thought of one other benefit which might be relevant. It’s possible that some of the concrete implementations could provide more optimized versions of some of the general methods.

    Enumerable.Count is a good example of this – it explicitly checks whether the sequence implements IList or not, because if it does it can call Count on the list instead of iterating through the whole sequence. If IEnumerable<T> had been an abstract class with a virtual Count() method, it could have been overridden in List<T> rather than there being a single implementation which knows about IList explicitly. I’m not saying this is always relevant, nor that IEnumerable<T> should have been an abstract class (definitely not!) – just pointing it out as a small possible disadvantage. That’s where polymorphism really would be appropriate, by specializing existing behaviour (admittedly in a way which only affects performance instead of the result).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 92k
  • Answers 92k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Ok, apparently bazaar leaves a file with appended ".~1~" to… May 11, 2026 at 6:28 pm
  • Editorial Team
    Editorial Team added an answer Each browser instance will have its own set of cookies.… May 11, 2026 at 6:27 pm
  • Editorial Team
    Editorial Team added an answer I'm not aware of any parallel linking tools; I do… May 11, 2026 at 6:27 pm

Related Questions

Is there a way to enforce/limit the types that are passed to primitives? (bool,
The situation is as follows. public interface IFoo { } public abstract class FooBase
C# 3.0 Extension methods add extensions to the base Type making calling that method
The simple demo below captures what I am trying to do. In the real
I'm after some good tips for fluent interfaces in C#. I'm just learning about

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.