Refactoring large constructors

后端 未结 3 934
情深已故
情深已故 2021-01-18 04:04

We have a few objects in our domain model with what you would comically term offensively large constructors, so large that IntelliSense gives up tr

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-18 04:32

    There's one thing that I'm not sure about your question, and that is why do you want all such parameters in the constructor? Are you using all of the parameters in the constructor code? Your problem with the intellisense is probably coming from having too many parameters on a single method. Having many number of fields / properties on a single type won't cause any issues.

    It seems that you've seen some ways to manage the number of args, but if you can explain why you need to receive all of them in a constructor, we can think outside this box. There might be something there to look at.

提交回复
热议问题