-1

I don't understand why it has to be static? What's the problem with being able to make an object for an extension method?

Septimius
  • 59
  • 8

1 Answers1

1

Extension methods are a shortcut to make it appear that a class has more methods than it actually does by allowing you to add a call to the extension method to a reference to an instance of the extended class. A non-static extension method would additionally require a reference to an instance of the extension class (as a non-static method may reference instance-specific state), and that wouldn't make sense in the syntax.

If you want to be able to perform a method on instances of two classes, you can do that, just not in the way you envision.

Robert Columbia
  • 6,313
  • 15
  • 32
  • 40