I read this statement in a C# book.
Enumerations do not necessarily need to follow a sequential ordering, and need not have unique values.
If I understand that statement, it means one of this is acceptable (I don't know which):
1.
enum EmpType
{
Manager = 1,
Grunt = 1,
Contractor = 100,
VicePresident = 9
}
2.
enum EmpType
{
Manager = 10,
Manager = 1,
Contractor = 100,
VicePresident = 9
}
Can someone please explain to me? I thought C# was supposed to be a subset of C/C++.
The first one would be valid, you may have duplicate Values
not duplicate Names
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