I\'ve gotten to a point where my main code file is about a thousand lines long and it\'s getting un-manageable; that is, I\'m starting to get confused and not know where to
Yes you can split any partial class across as many files as you like.
For large classes use either:
a. Region blocks eg
#region // Members
int my_int;
// other members...
#endregion
b. partial keyword to break a single class accross several files.
Although what other people say about partial classes
is true. I'd also suggest you to analyze refactoring opportunities on your class.
If you're having problems to manage it, you could try to split your single class in several classes with less responsibilities.
IMHO partial classes may not help very much. Do you have your class separated in regions
? Regions improve the readability of your code.
Yes, but you need to be in the same namespace and declare the class just like you did in the main file, an example:
file1.cs
namespace Names
{
public partial class Hello
{
public void DoSomething() { }
}
}
file2.cs
namespace Names
{
public partial class Hello
{
public void Go() { DoSomething(); }
}
}