Enum inheriting from int

前端 未结 9 1267
借酒劲吻你
借酒劲吻你 2020-12-17 08:43

I\'ve found this all over the place in this code:

public enum Blah: int
{
    blah = 0,
    blahblah = 1
}

Why would it need to inherit fro

9条回答
  •  萌比男神i
    2020-12-17 09:10

    int is by default the type of any enum. It does not need to be declared explicitly.

    It's more useful when you want to use something else (byte, long, and friends).

提交回复
热议问题