Partial Classes in C#

后端 未结 20 2976
时光说笑
时光说笑 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:55

    It is in part to support scenarios (WebForms, WinForms, LINQ-to-SQL, etc) mixing generated code with programmer code.

    There are more reasons to use it. For example, if you have big classes in large, unwieldy files, but the classes have groups of logically related methods, partial classes may be an option to make your file sizes more manageable.

提交回复
热议问题