C#C
C#2y ago
BekirK

✅ How to set enum default int value

Hi everyone, I have an enum type. For example as below. Normally, the value of enums in the db starts from 0. I know that if we want to start from 1, saying '=1' for the first value is enough.

The question I want to ask you about is that you can do this process automatically with typeconfiguration etc. Can I do it somewhere? The reason I want this is because I have many enums. And I want them all to start from 1. What do you think about it :)

public enum MyEnum
{
FValue,
SValue,
TValue
}
Was this page helpful?