-
Notifications
You must be signed in to change notification settings - Fork 4
Gendarme.Rules.Design.FlagsShouldNotDefineAZeroValueRule(2.10)
Sebastien Pouliot edited this page Jan 22, 2011
·
2 revisions
Assembly: Gendarme.Rules.Design
Version: 2.10
This rule ensures that enumerations decorated with the [System.Flags] attribute do not contain a 0 value. This value would not be usable with bitwise operators.
Bad example (using 0 for a normal value):
[Flags]
[Serializable]
enum Access {
Read = 0,
Write = 1
}
Bad example (using None):
[Flags]
[Serializable]
enum Access {
// this is less severe since the name of the 0 value helps
None = 0,
Read = 1,
Write = 2
}
Good example:
[Flags]
[Serializable]
enum Access {
Read = 1,
Write = 2
}
Note that this page was autogenerated (3/17/2011 9:31:58 PM) based on the xmldoc
comments inside the rules source code and cannot be edited from this wiki.
Please report any documentation errors, typos or suggestions to the
Gendarme Mailing List. Thanks!