How to organise large code files?

后端 未结 7 1077
失恋的感觉
失恋的感觉 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:07

    If I understand you, your main problem is that your forms end up being too big, which leads to the classes for those forms containing too much code, which is quite normal if your forms aren't very simple. The way to try minimize this is by using User Controls since if you move the controls to other classes, you also move the code behind to other classes.

    It can sometimes make it a little more difficult to communicate between the controls, but that's usually more than made up for by the fact that the code in each class will be much easier to understand.

提交回复
热议问题