关闭

21.4 Enum values and operations

511人阅读 评论(0) 收藏 举报
Each enum type defines a distinct type; an explicit enumeration conversion (
§13.2.2) is required to convert
between an enum type and an integral type, or between two enum types. The
set of values that an enum type
can take on is not limited by its enum members. In particular, any value of
the underlying type of an enum
can be cast to the enum type, and is a distinct valid value of that enum
type.
Enum members have the type of their containing enum type (except within
other enum member initializers:
see §21.3). The value of an enum member declared in enum type E with
associated value v is (E)v.
The following operators can be used on values of enum types: ==, !=, <, >,
<=, >= (§14.9.5), + (§14.7.4),
- (§14.7.5), ^, &, | (§14.10.2), ~ (§14.6.4), ++, -- (§14.5.9 and §14.6.
5), and sizeof (§25.5.4).
Every enum type automatically derives from the class System.Enum (which, in
turn, derives from
System.ValueType and object). Thus, inherited methods and properties of
this class can be used on
values of an enum type.
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:565923次
    • 积分:11485
    • 等级:
    • 排名:第1340名
    • 原创:565篇
    • 转载:0篇
    • 译文:0篇
    • 评论:50条
    文章分类