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?
It's generally better to arrange definitions by modularity, rather than by kind.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With