Skip to content
Discussion options

You must be logged in to vote

Yes, I'm looking for something like an public static abstract property.

There is no such feature in .NET/CLR. static means no runtime dispatching. So no inheritance on static members.

That being said, such feature can be simulated easily with singleton classes as type class. Nothing fancy. That's also how they are implemented in languages supporting that. It is just that: it is a high level feature, while static is already bound to the low level foundational feature, which many others rely on.

As an example:

class ATypeClass {
    public int X { get; set; }
}
class A {
    public static ATypeClass TypeClassInstance = new ATypeClass();
    public ATypeClass TypeClass { get { return TypeC…

Replies: 8 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by YairHalberstadt
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants
Converted from issue

This discussion was converted from issue #2196 on October 21, 2020 11:04.