1、变量(Variables)首个字母小写,随后如有单词,首个字母大写,如firstNumbe 临时变量名的命名规则:i、j、k、m、n用于数字型变量,c、d、e用于字符型变量
2、方法名(Methods)方法名应该是动词,如果超过两个单词,则每个单词首个字母大写,如GetBackground()
3、常量(Constants)名称全部使用大写字母,两个单词之间用下划线连接,如ARRAY_SIZE
4、c#控件命名缩写
Button btn
Calender cld
CheckBox chk
CheckBoxList chklst
CompareValidator cv
DataGrid dg
DataList dl
DropDownList ddl
Image img
ImageButton imgbtn
Label lbl
LinkButton lnkbtn
ListBox lstb
Panel pnl
RadioButton rdo
RadioButtonList rdolist
RangeValidator rv
RegularExpressionValidator rev
RequiredFieldValidator rfv
Table tbl
TextBox txt
ValidatorSummary vs
ColorDialog clordlg
FolderBrowerDialog fbdlg
FontDialog fntdlg
SplitContainer sc
LinkLabel lnklbl
GroupBox grp
HelpProvider hlp
ListView lstv
OpenFileDialog ofiledlg
PageSetupDialog psdlg
PictureBox pic
PrintDialog pntdlg
PrintDocument pntdmt
PrintPreviewControl pntpvctrl
PrintPreviewDialog pntpvdlg
ProgressBar pgb
SaveFileDialog sfiledlg
StatusStrip stus
StripMenu mnu
TabControl tabctrl
Timer timer
ToolTip ttp
TreeView trev
Form frm
ComboBox cbb
DateGridView dgv
DateTimePicker dtp
C#命规范(简单版)
最新推荐文章于 2024-04-12 10:32:06 发布