NET命名規範
1、
命名空間
使用Pascal大小寫,和類不要使用同樣的名稱,規則公司名+技術名稱+功能
樣本:AQH.BLL
2、
使用Pascal大小寫,用名字或名字短語命名
樣本:public class Button
3、
使用Pascal大小寫,給介面名字加上字母I首碼
樣本:public interface IServiceProvider
4、
屬性Attribute
應該總是將尾碼Attribute 添加到自訂屬性類中
樣本:public class ObsoleteAttribute
5、
枚舉Enum
Enum類型與值使用Pascal大小寫
6、
參數
使用Camel大小寫
樣本:GetType(string typeName)
Format(string format)
7、
方法
使用動詞命名方法,使用Pascal大小寫
樣本:RemoveAll() GetNextStudent()
8、
屬性 Property
使用名字命名屬性,使用Pascal大小寫
9、
事件
使用EventHandler尾碼,使用Pacal大小寫
樣本:public delegate void MouseEventHandler(object sender,MouseEventArgs
e)
10、
常量 Const
所有動詞大寫,多個單詞用底線隔開
樣本:public const string PACE_TITLE=”Welcome”;
11、
欄位
Private 、protected 使用Camel大小寫
Public使用Pacal大小寫
控制項簡寫對照表
Button |
btn |
btnSubmit |
CheckBox |
chk |
chkBlue |
CheckBoxList |
chkl |
chklBlue |
DropDownList |
drop |
dropCatagory |
HyperLink |
lnk |
lnkDetail |
Image |
img |
imgPhone |
Label |
lbl |
lblResults |
Panel |
pnl |
pnlForm1 |
RadioButton |
rad |
radBlue |
Repeater |
rpt |
rptQueryResult |
Table |
tbl |
tblCategory |
TextBox |
txt |
txtFirstName |
|
|
|
|
|
|
|
|
|