Skip to content
Discussion options

You must be logged in to vote

Unfortunately, the C# language team, in their infinite wisdom, crippled the static-method interface system in the name of "backwards compatibility". There were some minor edge-cases where adding a static method after-the-fact to an interface might change the behaviour of the derived types that never saw that method before.

So, instead of just accepting this edge-case and informing programmers to watch out for this issue and have a 1 time fix-up for the edge-cases... they instead compromised all future code written with this feature. Thanks Microsoft.

The crux of it is this:

You cannot directly invoke a default static method. i.e.

public interface Base
{
    static virtual int Foo() =>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@IlyaVassyutovich
Comment options

Answer selected by IlyaVassyutovich
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants