21.4 ENUM VALUES AND OPERATIONS

xiaoxiao2021-04-05  259

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 BEGEEN 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 what enum

TYPE.

ENUM MEMBERS HAVE TYPE OF THEIR Containing Enum Type (Except With

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 profment

THIS CLASS CAN BE USED

VALUES OF An Enum Type.

转载请注明原文地址:https://www.9cbs.com/read-132025.html

New Post(0)