Closed nickbabcock closed 11 years ago
From Framework Design Guidelines
DO name the zero value of flag enums None. For a flag enum, the value must always mean “all flags are cleared.”
Thus the solution to reassign ValueWrite.None
from 1 to 0. The other enum values should be decremented by a power of two.
If the client tries to execute ValueWrite.None | ValueWrite.Quote
, the result is ValueWrite.Quote
The
ValueWrite
enum is an enum that has theFlags
attribute. Clients are encouraged to use bitwise operations to create combinations of the enum to get their desired result. The problem is that there is aNone
option forValueWrite
. What does it mean for a value to beNone
andQuoted
, etc?Ideally, a client shouldn't be allowed to specify None combined any other option.