C# Coding Standards document
Version 1.5
Why create yet another coding standard document?
There have been numerous attempts to document C# Coding
Standards since the language was released, but most are
either overly verbose, too restrictive, or try to cover
every single scenario. This is my attempt to start from
scratch and write a new standards document that is concise,
simple to read & use, and creates a pragmatic balance of
rule enforcement. Having said that, I'm sure that many of
you will have just as many disagreements with this document
as I have with others, but I am always up for a good debate.
![]()
Goals and objectives:
- Cover all major C# Language features.
- Provide guidelines on coding style & language usage (but not syntax)
- Demonstrate all rules in code where applicable.
- Describe rules in structure that is easy to read & use.
- Define clear & concise rules.
- Use consistent terminology & rule patterns.
- Only provide rules where there is a clear cut best practice.
- Lead developers to a "pit of success" and avoid common "pits of failure"
Release Notes:
- Added numeric datatype usage guidelines.
- Adjusted guidelines for public, protected, and internal access modifiers.
- Tweaked verbage throughout document.
- Modified layout & added License Agreement. Misc. grammar adjustments.
-
Removed rules on foreach vs for pending additional
research.
- Added rules on switch/case statements.
- Revision(a) recommends custom Exceptions to subclass Exception not ApplicationException
-
Modified code commenting and formatting rules.
- Modified various code examples.
- Modified Exception Handling and Flow Control sections.
- Modified formatting.
- Restructured “Language Usage” section.
-
Corrected language, and added code examples.
- Consolidated conflicting rules.
-
Modified naming conventions for Internal and Protected
identifiers.
- Added, modified, & removed misc rules.
- Corrected grammar, code, and some verbiage.
- Changed style & formatting.
- Added Quick Summary tables.
- Added/modified various standards.
- Split .NET guidelines into separate document.
- Changed overall scope and goals. Restructured sections. Improved Introduction.
- Added Scope and Terminology sections.
- Added Bibliography, Resources, and .NET Framework Guidelines.
- Misc. adjustments to various rules.
- Updated Naming Conventions.
- Misc. grammar and syntax changes.
- Changed formatting and organization.
- Added code examples.
- Added more Language Usage.
- Created