Partial Classes in C#

后端 未结 20 2825
广开言路
广开言路 2021-02-19 08:25

Are there are good uses of Partial Classes outside the webforms/winforms generated code scenarios? Or is this feature basically to support that?

20条回答
  •  太阳男子
    2021-02-19 08:59

    Generally, I consider it a code smell.

    If your class is that complicated then it can probably be broken up into smaller reusable components.

    Or it means that theres no inheritance hierarchy where there should be one.

    For code generation scenarios it's good but I think code generation is another code smell.

提交回复
热议问题