Main Site Documentation

General C# question


I would like to move all of my wiznet setup code out of my Main() statement. Is there a way that I can put this into another file (similar to a .h file in C++)? If so, how?


Main is the function that is the entry point of your application. You still have to call wiznet initialization. You can move initialization code it into a separate method and define that method in different file for the same class or in the different class.
If you want the same class, but different file look for “partial” keyword in c#.

Anyways what are you trying to achieve?


Just wanting to make the code easier to read.


C# and Visual Studio have everything you need to make it happen. If you haven’t read about it yet I suggest to look at Refactoring. There are plenty of materials on the topic.