Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1 of 2
CONSTANTS FIELDS CONSTRUCTORS FINALIZERS (destructors) EVENTS PROPERTIES METHODS FUNCTIONS PRIVATE FUNCTIONS PRIVATE METHODS
In this order
naming rules NO hungary notation YES camelCase PascalCase Class Constant Delegate Enum Event Field Function Generics Interface Method Namespace Parameters Project file Property Solution Source file Struct PascalCase PascalCase PascalCase PascalCase PascalCase camelCase PascalCase T + PascalCase I + PascalCase PascalCase PascalCase camelCase PascalCase PascalCase PascalCase PascalCase PascalCase Attributes Collections Enums Exceptions Resources name + Attribute name + Collection name + Type name + Exception PascalCase
V1.0
2 of 2
xml document tags (frequently used) <summary> <remarks> <value> <para> <param> <return> <c> <exception> <see cref=> <seealso cref=> <example> <code> <![CDATA[ ]]> required required as needed optional as needed as needed as needed as needed optional optional as needed as needed as needed
Company.Product.Module.SubModule.Name
AssemblyInfo file AssemblyVersion CLSCompliant ComVisibleAttribute Assemblies Sign with strong name
coding general style rules Access modifiers Comments Comments Curly braces Events Lines Native data types Own reference Parameters Tabs Underscores UpperCase Variables Explicity always Only to explain Try use // or /// only One per line Check for null before Max. 80-120 characters int vs Int32, etc Use this inside them Recommended Max. 7 With size of 4 Avoid their use For 2 or fewer letters One per declaration Avoid Catch Custom Throw
exceptions Custom Exceptions Only to handle it Derive from Exception throw; vs throw e;
solution file
other recommendations Avoid sbyte, short, uint, and ulong (only for interop P/Invoke) Financial or money decimal type
Information: Based in StyleCop 4.5 RTM and my personal experience Optimized for Visual Studio 2010 and .NET Framework 4 v1.0 - July - 2011
References: StyleCop Rules v4.5 chm help file of Andy Reeves IDesign C# Coding Standard v2.4 of Juval Lowy