I,Environment Settings
First, remove the following options in the VS development environment:
Adjust indentation when pasting
Place the left braces of the type in the new line
Place the left braces of the method in the new line.
Place the left braces of the anonymous method on the new line.
Place the left braces of the control block on the new line.
Place "else" on a new line
Place "catch" on a new line
Place "finally" on a new line
Check box removed.
II,Naming rules
1) versatility
L The total length of the logo cannot exceed 32 characters.
L The basic syntax of an identifier is a word consisting of letters, numbers, and underscores (_). The first character cannot be a number.
L if appropriate, append the calculation qualifier (Avg, Sum, Min, Max, Index) at the end of the variable name ).
L use complementary pairs in variable names, such as min/max, begin/end, and open/close.
L Boolean variable names should be prefixed with or contain Is (is ).
L try to minimize the use of abbreviations, but use the abbreviations created in a consistent manner. The abbreviation should have only one meaning. Similarly, each abbreviation should have only one abbreviation. For example, if min is used as the abbreviation of minimum, it should be done in all places; do not use min as the abbreviation of minute again.
L include a description of the return value when naming a function, such as GetCurrentWindowName ().
L avoid reusing names for different elements, such as routines named ProcessSales () and variables named iProcessSales.
L avoid out-of-the-box homophone meanings (such as write and right) when naming elements to avoid confusion during code check.
L avoid commonly misspelled words when naming elements. In addition, you should be clear about the differences between spelling areas, such as color/color and check/cheque.
L avoid using the same name as the name in the external range within the internal range. If an error variable is accessed, an error is returned. If a variable conflicts with a keyword of the same name, you must add an appropriate type library before the keyword for identification. For example, if there is a variable named date, you can only use the internal Date function by calling System. Date.
L The interface name starts with "I", followed by a noun or noun phrase (such as IComponent), or an adjective (such as IPersistable) that describes the interface behavior ). Do not use underscores. Do not use abbreviations too much because abbreviations can cause confusion.
L The Name Of The event handler starts with a term describing the event type, followed by the suffix "EventHandler", such as "MouseEventHandler ". The name of the event parameter class must be suffixed with "EventArgs.
L if an event contains the concept of "before" or "after", use the prefix in the current or past format, such as "ControlAdd" or "ControlAdded ".
L split a single long string into multiple lines for writing. When a row is divided into several rows, the concatenation operator must be placed at the end of each row.
L in SQL Server, do not add sp prefix to stored procedures/do not add fn _ prefix to user-defined functions/do not add xp _ prefix to extended stored procedures. These prefixes are reserved for the identification system. Place each major SQL clause on different rows, making it easier to read and edit statements.
L do not use a literal number or a literal string, such as For I = 1 To 7. Instead, we use a naming constant, For example, For I = 1 To NUM_DAYS_IN_WEEK, To facilitate maintenance and understanding.
2) variable naming
Naming rules for variable names: Adjectives + nouns (or nouns)
- Attributes (private variables corresponding to class attributes)
L The class attributes correspond to the same private variables as the class attributes.
The private variable corresponding to the class property is added "_" before the class property name.
For example, private int _ PageSize; // private variable corresponding to the class attribute
Public int PageSize {set {_ PageSize = value ;}// class attribute
L ensure that the case sensitivity is consistent. The first letter of each word must be in uppercase. The first letter of other words is also capitalized. No "_" is added between words.
L do not use public to define an attribute.
L The attribute name and class name start with a noun, such as EmployeeName and CarAccessory.
- Private variable (short term/long term)
L short syntax (private variable in the method/variable that is not frequently used)
Add "_" before u Definition
U, for example, string _ strSQL = null;
U The first letter of the first word must be in lower case, and the first letter of other words must be in upper case. No "_" is added between words.
L long-term (class private variables/method entry parameters)
U class private variable: Add "_" before, and the private variable corresponding to the class property is the same. The first letter of each word must be in uppercase. The first letter of other words is also capitalized. No "_" is added between words.
For example, private int _ PageSizeTmp;
U method entry parameter: the first letter of the first word must be in lower case, and the first letter of other words must be in upper case. If only one word is in lowercase. No "_" is added between words.
For example, public static int SendCTTVOSMS (string mobile, string content)
Public static string CallAccountHiVA (string restPhone, string userPhone)
- Global variable/static variable/Constant
L The definition must be in uppercase. For example, public static int SMS_TYPE = 2;
L The definition can also be in lower case.
For example, public static string VOSMS_UserName = "88000002 ";
L separate words.
3) function naming
Function naming rules: Verb + noun (or verb). The first letter of each word must be capitalized. No "_" is added between words.
For example, public static string GetOrderStatus (int sendMode, int statueID)
The function name and method name start with a verb, such as InitNameArray () and CloseDialog ().
4) control naming
Control naming rules: Category + name
Category Table:
Prefix
Type
Frm
Window
Btn
Button
Cbo
Drop-down list box
Txt
Text input box
Lbl
Tag
Img
Image
Pic
Image
Div
DIV
Grd
Grid
Scr
Scroll bar
Lst
List box
Sds
SqlDataSource
Ods
OleDbDataSource
For example, button: btnSave
Prefix
Type
B/is
Bool
C
Char
Sb
Sbyte
B
Byte
N/I
Int
Ui
Uint
L
Long