Choosing the default value of an Enum type without having to change values

前端 未结 13 2714
迷失自我
迷失自我 2020-12-04 07:46

In C#, is it possible to decorate an Enum type with an attribute or do something else to specify what the default value should be, without having the change the values? The

13条回答
  •  没有蜡笔的小新
    2020-12-04 08:29

    The default for an enum (in fact, any value type) is 0 -- even if that is not a valid value for that enum. It cannot be changed.

提交回复
热议问题