Static Abstracts in Interface - Design Question #5427
Replies: 3 comments 3 replies
-
Because static methods in interfaces were introduced in C# 8, and means non-abstract method. |
Beta Was this translation helpful? Give feedback.
-
Interface types already support classic static members since C# 8 I believe: The |
Beta Was this translation helpful? Give feedback.
-
Consider:
This is static with no body. But this means it's an auto prop (that's not abstract). So to make it abstract we need a way to mark it as such. And because of that, we would want methods to be consistent with this. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been thinking about it, and can't figure out why use the abstract keyword for declaring such methods.
Why the declaration syntax for such methods is:
and not simply:
I think the declaration syntax without
abstract
is more clear, and is more consistent with the design of other features of interfaces. i.e:Beta Was this translation helpful? Give feedback.
All reactions