When a class is defined as a private static, why do I need to make the get and set methods static?
A:
Because you can't return a static member from an instance method.
Justin Niessner
2010-03-11 16:15:39
That makes sense! Thank you:)
2010-03-11 16:18:13
A:
It seems redundant to have to mark all members in a static class as static but C# requires that you do this. It's just the way the compiler was implemented.
As far as I know there are no members that inherit any modifiers from the type by default. In other words, a public class's members are not all public by default, etc. By requiring that you mark each member as static you are explicitly laying out the contract of the type.
Andrew Hare
2010-03-11 16:16:10