I know that a static class cannot have non-static methods. It makes sense. But if so, why isn't all methods in a class implicitly static?
public static class Foo
{
public void DoStuff(); // Does not compile.
}
In the example above, why doesn't the compiler implicitly make the method DoStuff()
static if that's the only option? I guess it could be a readability thing, but is there anything more to it?
For example, the compiler implicitly sets different access modifiers for different types (classes, enums, interfaces, nested etc...). Couldn't it do the same for static methods?
The reason why I ask is that I'm currently writing a lot of HtmlHelpers of a MVC-project where the helper class is static, and I'm constantly missing to mark the methods as static.