Why can\'t the keyword this be used in a static method? I am wondering why C# defines this constraint. What benefits can be gained by this constraint?
[
I am not sure if this helps your problem, but I believe these two code snippets are equivalent:
MyStaticClass.foo();
and simply
foo();
will both call the foo() method in the MyStaticClass class, assuming you call foo() from inside MyStaticClass
Edit - The easiest way to remember the difference between a static class and a non-static class is to think of something like the Math class in java. You can call Math.abs(x); to get the absolute value of x, and it does not really make sense to instantiate a Math object, which is why Math is a static class.