C#编码规范(简表)
注意:
1. 详细规范请参考:C#编码规范
2. 本规范仅摘录常用的控件,完整请参考完整规范
Win Form | ||
扩展名 Extension File Name | 描述 Description | 前缀 Prefix |
.cs | 窗体文件 | frm |
.cs | 类文件 | / |
Web Form | ||
扩展名 Extension File Name | 描述 Description | 前缀 Prefix |
.aspx | / | |
.ascx | Web用户自定义控件 | wuc |
Win Form内部控件命名规范 | ||
控件类型 Control Type | 前缀 Prefix | 例子 Example |
Label | lbl | lblStartSync |
LabelLink | lbk | |
Button | btn | |
TextBox | txt | |
MainMenu | mnu | |
CheckBox | chk | |
RadioButton | rdo | |
GroupBox | grp | |
PictureBox | pic | |
Panel | pan | |
DataGrid | grd | |
ListBox | lst | |
CheckedListBox | chklst | |
Combo | cbo | |
ListView | lstv | |
TreeView | trv | |
TabControl | tab | |
DateTimerPicker | dtp | |
MonthCalendar | cld | |
HScrollBar | hsb | |
VScrollBar | vsb | |
Timer | tmr | |
Splitter | spl | |
DomainUpDown | dup | |
NumericUpDown | nup | |
TrackBar | trk | |
ProgressBar | pgr | |
RichTextBox | rtxt | |
ImageList | imglst | |
HelpProvider | hlp | |
ToolTip | tlp | |
ContextMenu | mnu | |
ToolBar | tlb | |
StatusBar | sta | |
NotifyIcon | nti | |
OpenFileDialog | ofd | |
SaveFileDialog | sfd | |
FolderBrowserDialog | fbd | |
FontDialog | fdg | |
ColorDialog | cdg | |
PrintDialog | pdg | |
PrintPreviewDialog | ppd | |
PrintPreviewControl | ppc | |
ErrorProvider | erp | |
PrintDocument | prd | |
PageSetupDialog | psd | |
CrystalReportViewer | crv | |
Web Form内部控件命名规范 | ||
控件类型 Control Type | 前缀 Prefix | 例子 Example |
Label | lbl | lblTip |
TextBox | txt | txtName |
Button | btn | btnOK |
LinkButton | lbtn | |
ImageButton | ibtn | |
HyperLink | hlk | |
DropDownList | ddl | |
ListBox | lst | |
DataGrid | grd | |
DataList | dlst | |
Repeater | rep | |
CheckBox | chk | |
CheckBoxList | chklst | |
RadioButtonList | rdolst | |
RadioButton | rdo | |
Image | imgprintform | |
Panel | pan | |
PlaceHolder | plh | |
Calendar | cld | |
AdRotator | adr | |
Table | tbl | |
RequireFieldValidator | rfv | |
CompareValidator | cpv | |
RangeValidator | rgv | |
RegularExpressionValidator | rev | |
CustomValidator | cstv | |
ValidationSummary | vls | |
Xml | xml | |
Litteral | ltl | |
CrystalReportViewer | crv | |
数据库对象 Data Object | 前缀 Prefix | 例子 Example |
DataSet | ds | dsDept |
DataTable | dt | dtDept |
DataTableCollection | dtc | dtcDept |
DataView | dv | dvDept |
DataRow | dr | drDept |
DataRowCollection | drc | drcDept |
DataColumn | dc | dcField |
DataColumnCollection | dcc | dccDept |
DataRowView | drv | drvDept |
OleDb Data Provider | ||
OleDbDataAdapter | oleadp | |
OleDbConnection | oleconn | |
OleDbCommand | olecmd | |
Sql Server Data Provider | ||
SqlDataAdapter | sqladp | |
SqlConnection | sqlconn | |
SqlCommand | sqlcmd | |
Odbc Data Provider | ||
OdbcDataAdapter | odbcadp | |
OdbcConnection | odbcconn | |
OdbcCommand | odbccmd | |
Oracle Data Provider | ||
OracleDataAdapter | oraadp | |
OracleConnection | oraconn | |
OracleCommand | oracmd | |
菜单标题序列 | 菜单处理器名称 |
File Open | mnuFileOpen |
File Send Email | mnuFileSendEmail |
File Send Fax | mnuFileSendFax |
Format Character | mnuFormatCharacter |
Help Contents | mnuHelpContents |
数据类型 Data type | CLR类型 CLR Type | 前缀 Prefix | 例子 Example |
bool | System.Boolean | bln | |
byte | System.Byte | byt | |
sbyte | System.SByte | sbyt | |
char | System.Char | chr | |
decimal | System.Decimal | dec | |
double | System.Double | dbl | |
float | System.Single | flt | |
int | System.Int32 | int | |
uint | System.UInt32 | uint | |
long | System.Int64 | lng | |
ulong | System.UInt64 | ulng | |
short | System.Int16 | sht | |
ushort | System.UInt16 | usht | |
string | System.String | str | |
object | System.Object | obj | |
特殊类型前导字 | |
前导字 | 数据型态 |
a | 任何型态的数组(不区分为几维的数组) |
m | Class级变量前缀 |
I | 所有接口声明及变量都应以大写I作为前缀 |
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论