What is the motivation behind “Use Extension Methods Sparingly?”

前端 未结 7 1842
慢半拍i
慢半拍i 2021-02-05 23:38

I find them a very natural way to extend existing classes, especially when you just need to \"spot-weld\" some functionality onto an existing class.

Microsoft says, \"In

7条回答
  •  攒了一身酷
    2021-02-06 00:05

    When Borland invented them (Delphi Class Helpers) the guidance already was: "should be used in exceptional situations only".

    They have become a lot more accepted (as part of LINQ), but they remain an odd way add functionality. I think Reed has a good answer on why.

提交回复
热议问题