Whole program in 1 .cs file | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Whole program in 1 .cs file

I know PHP CMS like wordpress have alot of extra .php files each for something different, but how it looks like in C# programming, is it wrong to have a big Program in just one .CS File? or need a big Software to have for each Funtion inside a own .CS file? sorry for comparing this 2 languages but i come from webDev...and I want to start with C#

22nd Jul 2018, 2:07 AM
Zela Media
Zela Media - avatar
5 Answers
+ 4
I think this is the same in all languages, do you want a file with 34000 lines and have headaches searching code? I think not, always have an organized code Hope it helps you
22nd Jul 2018, 2:18 AM
Guillem Padilla
Guillem Padilla - avatar
+ 3
Maybe like this: private void button1_Click(object sender, EventArgs e) { Form2 form2= new Form2(); form2.Show(); } You're welcome
22nd Jul 2018, 2:38 AM
Guillem Padilla
Guillem Padilla - avatar
+ 2
If you are doing a Windows form application.. You only need to instantiate the second form in your main program, and execute secondform.show() in button click event
22nd Jul 2018, 2:35 AM
Guillem Padilla
Guillem Padilla - avatar
+ 2
Thank you some guys on Forums told me this only works with WPF or something u helpd me alot
22nd Jul 2018, 2:37 AM
Zela Media
Zela Media - avatar
+ 1
Thank you very much, Is there any good Tutorial how to implement let's say second.cs in my Main.cs so for example if I click a Button on my Main Program than show me something from second.cs THANK YOU
22nd Jul 2018, 2:32 AM
Zela Media
Zela Media - avatar