-
Notifications
You must be signed in to change notification settings - Fork 4
Gendarme.Rules.Design.EnumsShouldUseInt32Rule(git)
Sebastien Pouliot edited this page Mar 2, 2011
·
1 revision
Assembly: Gendarme.Rules.Design
Version: git
Enumaration types should avoid specifying a non-default storage type for their values unless it is required for interoperability (e.g. with native code). If you do use a non-default type for the enum, and the enum is externally visible, then prefer the CLS-compliant integral types: System.Byte, System.Int16, System.Int32, and System.Int64.
Bad examples:
public enum SmallEnum : byte {
Zero,
One
}
[Flags]
public enum SmallFlag : ushort {
One = 1,
// ...
Sixteen = 1 << 15
}
Good example:
public enum SmallEnum {
Zero,
One
}
[Flags]
public enum SmallFlag {
One = 1,
// ...
Sixteen = 1 << 15
}
You can browse the latest source code of this rule on github.com
Note that this page was autogenerated (3/17/2011 1:55:44 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!