Proposal: virtual extension methods/open classes #310
Unanswered
orthoxerox
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Copied from dotnet/roslyn#11211
I propose to extend the language with virtual extension methods. In my opinion, the conservative approach of MultiJava should be good enough to handle most use cases and could be relaxed later.
virtual
andoverride
. Extension methods cannot be markedabstract
ornew
.override
must belong to the same static class as the virtual extension method being overridden.This approach solves the use case of sharing one inheritance hierarchy between two assemblies and using virtual dispatch in both. It doesn't solve use cases like adding your own efficient LINQ methods to specialized enumerables, but I think shapes/higher-order generics solve that better.
Beta Was this translation helpful? Give feedback.
All reactions