-
Notifications
You must be signed in to change notification settings - Fork 4
Gendarme.Rules.Design.EnumsShouldUseInt32Rule(2.10)
Sebastien Pouliot edited this page Jan 22, 2011
·
2 revisions
Assembly: Gendarme.Rules.Design
Version: 2.10
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
}
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!