Organizing c# code into different files

c#, visual-studio, wpf

Solution

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(); }
    }
}

Problem

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 locate some things. It's well-commented but there's just too much stuff. I'd really like to be able to organize my code into different files, each with its own purpose. I want to get all the help VS gives me as I type when I edit these other files. A picture can say a thousand words: alt text http://img64.imageshack.us/img64/7848/codeorganizationscreens.png Is what I'm trying to do even possible?

Original source