Enum inheriting from int

前端 未结 9 1282
借酒劲吻你
借酒劲吻你 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条回答
  •  清歌不尽
    2020-12-17 09:15

    An enum "member" can have an underlying "value". The inheritance from int tells you what type the value will take.

提交回复
热议问题