Alex Rivera | Logout

Where is the best place to locate enum types?

Asked 2008-10-17T20:00:27.450
45

I have found that there is generally a singe type or namespace that takes in any particular enum as a parameter and as a result I have always defined those enums there. Recently though, I had a co-worker make a big deal about how that was a stupid thing to do, and you should always have an enum namespace at the root of your project where you define everyone of your enum types.

Where is the best place to locate enum types?

Edit
Report

1 Answer

3

If my enumeration has any chance of ever being used outside the class I intend to use it, I create a separate source file for the enum. Otherwise I will place it inside the class I intend to use it.

answered 2008-10-17T20:02:56.243

Your Answer