1 命名空间,类,方法,以及基类上的成员应使用Pascal规则命名。
Pascal规则是:第一个字母必须大写,并且后面的并发连结词的第一个字母均为大写,例如象GeneralManager、SmallDictionary、StringUtil都是合乎这种规则的类名.
如:
2 局部变量和方法中的参数用camel规则命名,并添加数据类型前缀。
camel规则是:第一个子串外的所有子串的第一个字母大写。
3 接口的名称加前缀 I.
interface ICompare
{
int compare();
}
4 方法的命名.一般将其命名为动宾短语.
ShowDialog()
CreateFile()
GetPath()
5.自定义的属性以Attribute结尾
public class AuthorAttribute : Attribute
{
}
6.自定义的异常以Exception结尾
public class AppException : Exception
{
}
7 常量 全部大写,单词之间以 “_” 分隔 例如:USER_PASSWORD
数据类型 缩写
bool-b float-flt unit-ui byte-by int—i ulong-ulng char-ch long—lng ushort-usht decimal-dec sbyte-sby string-str double-dbl short-sht object-obj emun-emn struct-st