分类代理类工具使用
第35页
statements; }
空的 for 语句(所有的操作都在initialization、condition 或 update中实现)使用格式 for (initialization; condition; update); // update user id foreach 语句使用格式
foreach (object obj in array) {
statements;
}
注意 1在循环过程中不要修改循环计数器。
2对每个空循环体给出确认性注释。
6.6 while 语句
while 语句使用格式 while (condition) {
statements; }
空的 while 语句使用格式 while (condition);
6.7 do - while 语句
do - while 语句使用格式 do {
statements;
} while (condition);
分类代理类工具使用
第36页
6.8 switch - case 语句
switch - case 语句使用格式 switch (condition) {
case 1:
statements; break; case 2:
statements; break; default: statements; break; } 注意:
1、语句switch中的每个case各占一行。 2、语句switch中的case按字母顺序排列。 3、为所有switch语句提供default分支。
4、所有的非空 case 语句必须用 break; 语句结束。
6.9 try - catch 语句
try - catch 语句使用格式 try {
statements; }
catch (ExceptionClass e) {
分类代理类工具使用
第37页
statements; } finally {
statements; }
6.10 using 块语句
using 块语句使用格式 using (object) {
statements; }
6.11 goto 语句
goto 语句使用格式 goto Label1: statements; Lable1:
statements;
分类代理类工具使用
第38页
7 第七章 控件命名规则
7.1 命名方法
控件名简写+英文描述,英文描述首字母大写
7.2 主要控件名简写对照表
控件名 简写
控件名
Label
lbl TextBox
Combox cbx ToolStrip Button
btn LinkButton ImageButton imgbtn DropDownList ListBox lst DataGrid DataList dl CheckBox
CheckBoxList chkls RadioButton RadioButtonList rdolt Image Panel
pnl Calender
AdRotator
ar Table
RequiredFieldValidator rfv CompareValidator
RangeValidator
rv RegularExpressionValidator ValidatorSummary
vs CrystalReportViewer
8 第八章 其他
8.1 表达式
1 避免在表达式中用赋值语句
3 避免对浮点类型做等于或不等于判断
简写
txt
tsp lnkbtn ddl
dg chk rdo img cld tbl cv
rev rptvew
分类代理类工具使用
第39页
8.2 类型转换
1尽量避免强制类型转换。
2如果不得不做类型转换,尽量用显式方式。