Can you make an Extension Method Static/Shared?

后端 未结 1 1221
野性不改
野性不改 2021-01-18 01:37

OK, I\'ve probably misunderstood something here but, as far as I can see ...

  • An extension method has to be contained in a module, not a class
  • You can\
相关标签:
1条回答
  • 2021-01-18 01:56

    You are correct. Extension methods can only act on instances of a type.

    And no, unfortunately there's no crafty way to write extension methods that act on the types themselves, behaving like static methods.

    0 讨论(0)
提交回复
热议问题