I\'m glad C# doesn\'t let you access static members \'as though\' they were instance members. This avoids a common bug in Java:
Thread t = new Thread(..);
t.
I'd agree this is a misfeature. I don't know how often someone on Stack Overflow has posted code of:
ASCIIEncoding.ASCII
etc... which, while harmless in terms of execution is misleading in terms of reading the code.
Obviously it's too late to remove this "feature" now, although I guess the C# team could introduce a super-verbose warning mode for this and other style issues.
Maybe C#'s successor will improve things...
This is useful in WinForms.
In any control or form, you can write MousePosition
, MouseButtons
, or ModifierKeys
to use the static
members inherited from Control
.
It's still debatable whether it was a good decision.