原创 2017年03月13日 08:54:34

文献:msdn library
平台:.NET 2.0+

from ms official guideline:

1 We use Allman style braces, where each brace begins on a new line.

while (x == y)


2 We use four spaces of indentation (no tabs).

3 We use camelCase for internal and private fields and use readonly where possible. Prefix instance fields with , static fields with s_ and thread static fields with t_. When used on static fields, readonly should come after static (i.e. static readonly not readonly static).

4 We avoid this. unless absolutely necessary.

5 We always specify the visibility, even if it’s the default. Visibility should be the first modifier.

private string _foo //better
string _foo  //bad
public abstract //better
abstract public //bad

6 Namespace imports should be specified at the top of the file, outside of namespace declarations and should be sorted alphabetically.

using System.IO;
using System.Collections;

namespace CAXA.MES.UI.Performance.Board
  public class LinkedList



7 Avoid more than one empty line at any time. For example, do not have two blank lines between members of a type.

8 Avoid spurious free spaces.

if (someVar == 0)..., 

9 If a file happens to differ in style from these guidelines (e.g. private members are named m_member rather than _member), the existing style in that file takes precedence.

10 We only use var when it’s obvious what the variable type is.

var stream = new FileStream(...) //var is OKay
var stream = OpenStandardInput() // here var is not good

11 We use language keywords instead of BCL types.

 int, string, float // good
 Int32, String, Single // bad

12 We use PascalCasing to name all our constant local variables and fields. The only exception is for interop code where the constant value should exactly match the name and value of the code you are calling via interop.

private const int Age=100; //good

13 We use nameof(…) instead of “…” whenever possible and relevant.

14 Fields should be specified at the top within type declarations.

15 When including non-ASCII characters in the source code use Unicode escape sequences (\uXXXX) instead of literal characters.

版权声明:本文为博主原创文章,欢迎转载,请注明 http://blog.csdn.net/daigualu


  • 2003年04月30日 00:00
  • 676KB
  • 下载

官方 raywenderlich.com Swift 编程风格指南

转载于:点击打开链接 本文版权归 raywenderlich.com 、The Official raywenderlich.com Swift Style Guide项目以及所有贡献者所有...


.net框架: 编译过程: 运行过程: 编译和运行过程: CLR:


PEP 8 – Style Guide for Python Code

Google C++编程风格指南

  • 2017年12月05日 17:27
  • 705KB
  • 下载

Google C++编程风格指南

  • 2017年11月11日 14:36
  • 457KB
  • 下载

MATLAB 编程风格指南

文章转自:http://blog.csdn.net/chenyusiyuan/article/details/189237 MATLAB 编程风格指南      ——Richard  Johnson ...