Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual C# - Calling function from another *.cs file

I usually been creating small programs, so i never bothered about putting code in few files, but today, i finally decided (as my program has grown) to put some of the functions in other *.cs file, so i would have only button actions handling in form1.cs and i would call functions here, and i would like to have all my functions code in functions.cs for example. That would let me to keep my code little more tidy.

EDIT: I thought thats obvious, that i am asking how to put these functions in other file, and then how to call them, but i see some people don't even try to understand, and just downvote and just trying to be smart. ;) I also thought that "creating small programs" meant, i never had to use any classes, or other stuff like that, as small programs means i am bloody beginner, and i need some guidelines what should i do/READ now, to proceed with my idea.

like image 480
Kedor Avatar asked Sep 24 '26 10:09

Kedor


2 Answers

I know most people dont like explaning to beginners and that is sad. Go here mate it will help you alot as a beginner! It has everything pretty good explained i`m sure it will help you alot.

http://thenewboston.org/list.php?cat=15

like image 182
Jordan Avatar answered Sep 26 '26 10:09

Jordan


This is a good idea. You can use the partial class feature of C# to achieve this result.

like image 37
Sergey Kalinichenko Avatar answered Sep 26 '26 11:09

Sergey Kalinichenko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!