Main Site Documentation

General C# question


#1

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?


#2

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?


#3

Just wanting to make the code easier to read.


#4

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.

http://msdn.microsoft.com/en-us/library/719exd8s.aspx