6
Answers

basic questions about enum

George George

George George

16y
2k
1

Hello everyone,


I have 3 basic questions about Enum, from MSDN,

http://msdn.microsoft.com/en-us/library/sbbt4032(VS.80).aspx

1.

It is mentioned "A variable of type Days can be assigned any value in the range of the underlying type;" -- I think it is not correct to say any value in the range of the underlying type, like integer, but in the range from Sat to Fri.

For example, you can not write Days d = 65535;

2.

"and if additional elements have been added to the enum type, the test for default values can return true unexpectedly." I do not quite understand this scenario, could anyone show me some code please?

3.

"You can notice these changes when using tools such as the Console class methods, the Expression Evaluator, and so forth. (See example 3).", I have tried example 3. But what are the rules for the changes when we add System.FlagsAttribute? The document only says there will be some changes, but not clearly states what will be the changes. Any ideas?


thanks in advance,
George

Answers (6)