24 February 2014

Use Proper Casing for Members

IdentifierCasingExample
Class, StructPascalStrategyManager
InterfacePascal with I prefixIStrategy
EnumerationPascalLoggingLevel
Enumeration ValuePascalInfo
Enumeration Representing Bit FieldPascal in pluralSearchOptions
EventPascalClick
Private FieldCamel with underscore_scheduler
Protected FieldCamel with underscore_scheduler
Constant FieldPascalPi
Constant VariableCameldefinitionKey
Readonly FieldCamel with underscore_listItems
Static Readonly FieldPascalListValues
VariableCamelvalue
MethodPascalComputeValue
PropertyPascalValue
ParameterCamelparameter
Type ParameterPascal with T prefixTValue
NamespacePascalSystem.Drawing
Abbreviation with 2 and less lettersAll CapsUI, IO
Abbreviation with 3 and more lettersPascalXml, Http
Use Proper Class Layout
Use the following order to position all your members inside the class. The resulting layout is the combination of all the lists provided with descending priority. That means that on the top of the file there will be all public const fields followed by internal const fields.
1.     Fields
2.     Delegates
3.     Events
4.     Properties
5.     Indexers
6.     Constructors
7.     Finalizers
8.     Methods
9.     Other stuff
Than follow access modifier.
1.     public
2.     internal
3.     protected
4.     private
After access modifier follow the type of the member.
1.     const
2.     static
3.     readonly
4.     nothing
The least significant sorting attribute is a declaration modifier.
1.     virtual
2.     abstract
3.     override
4.     new

No comments: