Imagine I have defined the following Enum:
public enum Status : byte
{
Inactive = 1,
Active = 2,
}
What\'s the best practice to use
I would say, it depends on how you use them. For flagging enum it is a good practice to have 0 for None value, like that:
[Flags]
enum MyEnum
{
None = 0,
Option1 = 1,
Option2 = 2,
Option3 = 4,
All = Option1 | Option2 | Option3,
}
When your enum is likely to be mapped to a database lookup table, I'd start it with 1. It should not matter much for professionally written code, but this improves readability.
In other cases I'd leave it as it is, giving no care whether they start with 0 or 1.