#FrameworkDesign

@bitbonk A default interface implementation would result in reflection seeing the method on the interface where it would not see the extension method.

I was going to say that one instance I can think of where this would have an impact is in list initialization, where the runtime detects an "Add" method with the required signature, but I have just read that the "Add" method can also be an extension method. I never knew that.

#dotnet #APIDesign #FrameworkDesign #FrameworkDesignGuidelines

bitbonkbitbonk
2022-11-22

When should I favor extension methods over 8 default interface implementations?

When I have an extension method in the same assembly and namespace as the interface it extends, is there any reason to *NOT* use a default interface implementation on the interface instead?


@bot

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst