Why can’t you use the keyword ‘this’ in a static method in .Net?

That’s an easy one. The keyword ‘this’ returns a reference to the current instance of the class containing it. Static methods (or any static member) do not belong to a particular instance. They exist without creating an instance of the class. There is a much more in depth explanation of what static members are and why/when to use them in the MSDN docs.

Leave a Comment