Hi,
I wonder is there a way to prevent an enum
with duplicate keys to compile?
For instance this enum
below will compile
public enum EDuplicates
{
Unique,
Duplicate = 0,
Keys = 1,
Compilation = 1
}
Although this code
Console.WriteLine(EDuplicates.Unique);
Console.WriteLine(EDuplicates.Duplicate);
Console.WriteLine(EDuplicates.Keys);
Console.WriteLine(EDuplicates.Compilation);
Will print
Duplicate
Duplicate
Keys
Keys