Hi,
Main方法作为程序的入口其实放在Program.cs或Form1.cs中都是可以编译执行的,但这样会导致项目的层次结构比较混乱。
Form1.cs中主要是用来编写有关Form1窗口的代码的。
而Program.cs中一般就是用来设置程序初始打开的窗口,不做其他多余的操作。如果要写一些通用的类,也不建议写在Program.cs中,而是新建一个新的cs文件。
Regards,
Kyle
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
MSDN Support, feel free to contact MSDNFSF@microsoft.com.