The reason why enumeration cannot be inherited in the c#
C# does not support enumeration inheritance
Although the "inheritance" enumeration in the middle layer naming space is very convenient, unfortunately, C# cannot be achieved. Meeting cannot inherit from others, but can only inherit from system.enum.
The grammar that looks like inherited is actually a way to change the underlying value of enumeration. However, all enumerations are still derived from System.enum. This act is specified in the CLI specification:
"All enumeration must be derived from System.enum"
The above is the detailed content of Why Can't I Inherit Enums in C#?. For more information, please follow other related articles on the PHP Chinese website!