Suppose I have enum, which underlying type is byte:
enum EmpType : byte
{
Manager = 1,
Worker = 2,
}
Can I cast some int literal to underlying type of this enum(byte in this case) ?
Something like this doesn't work (Error: "; expected"):
byte x = (Enum.GetUnderlyingType(typeof(EmpType)))15;
Can I cast to underlying type without explicitly writing (byte)15 ?
Thanks.