Static abstract init for interfaces #8470
Unanswered
budgetdevv
asked this question in
Language Ideas
Replies: 1 comment
-
How should the compiler enforce the initialization of a static property? Static constructors are executed when the runtime loads the type info for the first time, but that can happen transparently because there are no user-supplied arguments. Where would you expect an error to be reported, if you forgot to initialize the type and the only use is in a typeof-expression in an attribute? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Basically a way to define static readonly as a contract. It can be useful for performance optimization, as static readonly is treated as a runtime constant I believe.
Beta Was this translation helpful? Give feedback.
All reactions