Assuming that the enum or struct is not nested within a particular class i.e. it belongs to the project namespace, should it be defined in:
- Its own file
- A general-purpose file called
Enums.csorStructs.cswhere all theenums/structsthat belong to the project namespace would be defined - Somewhere else…
This MSDN article on enum best practices makes no recommendation on where to store enum definitions.
You’ll get different recommendations. Personally, I tend to store enums in the same file as the class they’re related to. I like to keep my file structure the same as my namespace structure, as much as possible, and so if my enums naturally fall into a particular namespace, I’ll store the definition in the corresponding file.
My suggestion is, find a scheme that works for you, and stick with it.