#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.

Advertisements

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: