Method Overloading. Can you overuse it?

前端 未结 16 1388
有刺的猬
有刺的猬 2020-12-02 13:38

What\'s better practice when defining several methods that return the same shape of data with different filters? Explicit method names or overloaded methods?

For exa

16条回答
  •  一整个雨季
    2020-12-02 13:45

    One thing you may consider is that you can't expose overloaded methods as operation contracts in a WCF Web Service. So if you think you may ever need to do this, it would be an argument for using different method names.

    Another argument for different method names is that they may be more easily discoverable using intellisense.

    But there are pros and cons for either choice - all design is trade-off.

提交回复
热议问题