tags:

views:

47

answers:

3

In order to organize various methods of my MainForm class, I would like to categorize them into several files. Of course, the methods would still need to access form elements and additional variables I added in the MainForm class.

What is the standard / best-practices way to do this?

+2  A: 

Sounds like you should look into using partial classes

Antony Koch
+3  A: 

That can be done using Partial Classes.

An alternative way to structure code within the file are Regions.

Of course, if your class code is so large that it needs to be split into multiple files you might want to consider refactoring it into multiple classes.

Heinzi
+1  A: 

The simple answer would be to use partial classes. This isn't really telling you about best practice design for your application.

I'd recommend reading Microsoft .NET: Architecting Applications for the Enterprise http://www.amazon.com/Microsoft-NET-Architecting-Applications-PRO-Developer/dp/073562609X

You can download the source code that goes with the book from codeplex. Just search for nsk.

The source code makes a lot more sense after reading the book.

Andrew