Is it a good idea to keep all the enums in one place?

Posted by kzen on Stack Overflow See other posts from Stack Overflow or by kzen
Published on 2010-04-06T17:24:14Z Indexed on 2010/04/06 17:33 UTC
Read the original article Hit count: 361

Filed under:
|

When I'm building a class library I usually create a file Enums.cs to hold all the enums used in the assembly. Here is an example:

namespace MyNamespace
{
    public enum Colors
    {
        Red,
        Green,
        Blue
    }
    public enum Shapes
    {
        Circle,
        Square,
        Triangle
    }
}

This makes all my enums easy to find, well organized and easy to access in code.

I'm wondering if there is any reason why this would not be such a good idea?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#