Partial Classes in C#

后端 未结 20 2993
时光说笑
时光说笑 2021-02-19 07:59

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:36

    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.

提交回复
热议问题