After working for a while, I found that the code development specification in the company had a big problem. I personally developed it based on my preferences.
I have summarized the development specifications that I think are more appropriate!
1. Class Name, attribute name, method name, file name in Pascal case format
2. variables. The method parameters are in the Camel case format.
3. Use meaningful and descriptive words to name variables
-Do not use the abbreviation. Use name, address, salary, and so on to replace nam, addr, sal
-Do not use single-letter variables such as I, n, x. Use index, temp, etc.
Variable exceptions used for loop iteration:
For (int I = 0; I <count; I ++ ){...}
If a variable is used only for iterative counting and does not appear elsewhere in the loop, many people prefer to use a single letter variable (I) instead of another name.
-The variable name does not contain underscores (_).
-The namespace must be named in standard mode.
4. The file name must match the class name.
For example, for the class HelloWorld, the corresponding file name should be helloworld. cs (or, helloworld. vb)
5. Three-layer naming rules
Entity layer: ClassInfo
Data Layer: DalClass (the same method should be named as uniform as possible). For example, each class has the Add Edit Delete method to Get the data prefix and Get
Business logic layer: BllClass
6. aspx File naming rules
PageNameAdd
PageNameList
PageNameEdit
7. Control naming
| Control |
Prefix |
Example |
| Label |
Lbl |
LblSurname |
| TextBox |
Txt |
TxtSurname |
| DataGrid |
Dg |
DgResults |
| Button |
Btn |
BtnSave |
| ImageButton |
Ibtn |
IbtnSave |
| Hyperlink |
Lnk |
LnkHomePage |
| DropDownList |
Ddl |
DdlCompany |
| ListBox |
Lst |
LstCompany |
| DataList |
Dlst |
DlstAddress |
| Repeater |
Rep |
Rection |
| Checkbox |
Chk |
ChkMailList |
| CheckBoxList |
Chk |
ChkAddress |
| RadioButton |
Rdo |
RdoSex |
| RadioButtonList |
Rdo |
RdoAgeGroup |
| Image |
Img |
ImgLogo |
| Panel |
Pan |
PanSection |
| PlaceHolder |
Plh |
PlhHeader |
| Calender |
Cal |
CalMyDate |
| Adrotator |
Adr |
AdrBanner |
| Table |
Tbl |
TblResults |
| [All] Validators |
Val |
ValCreditCardNumber |
| ValidationSummary |
Vals |
ValsErrors |
8 generic naming rules
IList <ExhibitorInfo> ILExhibitorInfo = new List <ExhibitorInfo> ()
Pascal case-the first letter of all words is in upper case, and the other letters are in lower case.
Camel case-except the first word, the first letter and other letters of all words are in upper case.