Types with Nested Enums

Problem
You want to know if it’s acceptable to nest an enum inside another type.

Solution
It’s acceptable if the enum type is used to define arguments or return values in one or more of the type’s methods.

Comments
An example of this technique in the .NET Framework is the System.Environment.SpecialFolder enum. This enum is used only as an argument to the GetFolderPath method of the System.Environment type.

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