How to organise large code files?

后端 未结 7 992
失恋的感觉
失恋的感觉 2021-02-06 09:27

I am increasingly aware that my code in any single file can often span hundreds of lines quite easily and although I know the implementation might be sound, it still feels messy

相关标签:
7条回答
  • 2021-02-06 10:11

    I tend to group properties, constructors, methods, and helper methods (private methods) together with regions. If I have a lot of methods, I create more regions based on what they do (especially good for overloads). And speaking of overloads, try minimizing your code with optional parameters.

    As far as I understand partial means that the class exists in two separate files. Webforms and controls are partial because the other "part" of the file is the as[p|c]x file that goes with it.

    0 讨论(0)
提交回复
热议问题