Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Most of the C# programmers I know embrace one of the common coding standards. However being aware of the standards is one thing, telling the differences is another.

Browsing the common coding standards documents our there on C#, my first reaction was it's more of the same. Admittedly I didn't bother reading everything. Has anyone ever compared them and point out the major differences between them?

share|improve this question
If I understand you correctly, you expect us to read through the three documents and find the differences for you? – Yannis Feb 10 '12 at 13:55
@YannisRizos of course not, I'm hoping that someone who already did can share his findings. Sorry about that. Changed the phrasing a bit. – KMoraz Feb 10 '12 at 14:00
You're missing the standard enforced by FxCop&StyleCop – Simon Feb 10 '12 at 14:28
@Simon is that not the same as the Microsoft one (unless you implement custom rules)? – jk. Feb 10 '12 at 14:37
The only coding standard that matters is Microsoft's. In the they wrote the language spec, so they are the best to write the standard, additional extensions can be made clearly. After you read ALL of those documents, come back and ask a specfic question, at this point your question cannot be answered. – Ramhound Feb 10 '12 at 15:46
up vote 6 down vote accepted

I did perform such a comparison, as part of my job.

I was asked to write coding style guidelines for a software engineering department. As this department was part of the military-industrial complex, the document I wrote was very detailed, and included parts of all of the documents you linked, as well as vast swaths of the Design Guidelines for Developing Class Libraries.

After I submitted my guidelines, I was asked to distill them down to 3 to 4 pages, and then to one crib sheet. In the end, the guidelines were not adopted. Instead, everyone in the department follows the rules encoded into Visual Studio.

Here is what I learned from the experience:

  1. The coding style to adopt is the one your shop already uses, unless they decide to adopt a new one.
  2. The guidelines for creating software libraries are already very well defined, and almost universally agreed upon by all, including the authors of the documents you linked.
  3. The only real variations you are going to see in coding style that are not already universally agreed on are those variations having to do with member variables inside classes (which Microsoft has left up to the taste of individual developers).
  4. The vast majority of the rules you need to know to develop a good coding style are already encoded in Visual Studio, FxCop, and other Code Analysis tools Microsoft provides.
share|improve this answer
You still don't answer the question. Also, what are "rules encoded into Visual Studio"? Visual Studio is an IDE. It doesn't (and doesn't have to) enforce any rule. If you name your class This_ISMyClass, you will violate every descent coding style document, but Visual Studio will let you do it. The same comes for wrong spacing around parenthesis, two consecutive newlines, etc. – MainMa Feb 10 '12 at 19:31
I changed my answer slightly to include FxCop, which covers the naming conventions you mentioned. But if you don't know about the style rules already built into Visual Studio, it's just because you haven't discovered them yet. Visual studio doesn't force you to use these rules; it's up to you not to override them. – Robert Harvey Feb 10 '12 at 19:39
Ok so you weren't taking about Visual Studio, but about Code Analysis and StyleCop. Which is similar to Microsoft Design Guidelines. – MainMa Feb 10 '12 at 20:51
When you close a brace in Visual Studio, Visual Studio reformats all of the code back to the beginning brace, according to Microsoft's style guidelines. If that's what you mean by Code Analysis, then yes, that's what I'm talking about. – Robert Harvey Feb 10 '12 at 20:54
No. For the difference between Code Analysis, FxCop and StyleCop, see As for Visual Studio reformat, you misunderstood the feature. It has nothing to do with Code Analysis, FxCop or StyleCop. Formatting is simply a set of options defined in the IDE and not related with any style guideline. See two last sentences of my first comment. – MainMa Feb 10 '12 at 21:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.