Static class members should be static by default? #8440
nextgenadarsh
started this conversation in
Polls
Replies: 1 comment
-
This is a very intentional design decision of the language. If you started out designing a static class, then in a later version made it non-static, without the current restriction all your members would now be instance members and all your callsites are broken. |
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
Uh oh!
There was an error while loading. Please reload this page.
-
Sample code:
public class MyStaticClass {
public static string Property1 { get; set; }
public string Property2 { get; set; } // compiler error
}
16 votes ·
Beta Was this translation helpful? Give feedback.
All reactions