#631 – Code-Generation Tools and Partial Classes

C# supports the idea of partial classes–splitting the implementation of a class across multiple files.

You might use partial classes for code that you author, to help organize your code.  (E.g. Creating a separate file for each interface that your class implements).  But the main reason that partial classes are useful is that code generation tools can implement their portion of a particular class in their own file.  Because a code generator “owns” the file, it can destroy and re-build its part of your class without affecting the code that you’ve written.