One Source File for Enum Types

You want to know how to organize your enum types.

Collect all enum types in a single file and name it Enums.cs.

Enum definitions are typically short. Placing all of them in a single file is advantageous for a number of reasons. First, it cuts down on the number of files in the solution. Second, it enables you to find what you’re looking for more easily. Finally, there are a couple of exceptions to this rule. One is when it makes sense to place them in different namespaces. Another is when you have enum types nested in other types.

Leave a Reply

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

You are commenting using your 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