How to declare enums in C#

Enum values should be from the same type. So your second example almost works. If you are using flags, you should give all the values an name or index, not just one:

enum cardValue { Val2 = "2", Val3 = "3", Val4 = "4", ValA = "A" };

Also, variable names, class names, enum values, etc. can’t contain only numerics. So there has to be a character in the name.

Browse More Popular Posts

Leave a Comment