C#命名规范(参考) (II)

C#命名规范(参考)

1.Class命名:采用Pascal方式,不加任何前缀或后缀,在微软给出的建议中认为这些是冗余信息。
2.Method命名:采用Pascal方式,使用动词或动词短语,如Remove();或GetCharArray();等。
3.参数命名: 采用Camel方式,微软反对使用匈牙利命名方式,认为匈牙利命名方式与具体编程语言

相关并且维护复杂,建议使用代表参数意义的名字。
4.Field命名:对于public、protected或internal修饰的采用Pacal风格,提倡避免使用,如需使用

可以用propety代替;对于private的采用Camel风格并以下划线(_)为前缀,微软不在提倡以m_为前

缀的field命名方式。
5.对于Static或Const变量参见第4条。
6.Propety命名:采用Pascal格式,命名要反映出对应的实体,并且不要以“Get”或“Set”为前缀


7.Variable命名:采用Camel格式,反映出变量代表的意思。
8.Interface命名:采用Pascal格式,以I为前缀。
9.使用Attribute作为自定义属性类的后缀

10.使用Exception作为自定义异常处理类的后缀
11.Naming Space命名:公司名称.技术名称[.Feature][.Design],如System.Window.Form
//文件命名
Project:Pascal格式,总是和联编以及根命名空间相同。
Source File文件:总是和类名相匹配,避免一个文件包含多个类的情况。


1.TextBox(txt)
2.DropDownList(list)
3.RequiredFieldValidator(val)
4.Label(lab)
5.CheckBox(chk)
6.ImageButton(btn)
eg:txtFirstName//listCountry//valFirstName//lblFirstName//chkShowFavorites//btnUpdate

 a、web控件
web控件名 缩写
AdRotator art
Button btn
Calendar cd
CheckBox chk
CheckBoxList chkl
CompareValidator cpv
CustomValidator ctv
DataGrid dg
DataList dl
DropDownList ddl
HyperLink hl
Image img
ImageButton Ibtn
Label lab
LinkButton lbtn
ListBox lst
Panel pl
PlaceHolder ph
RadioButton rb
RadioButtonList rbl
RangeValidator rv
RegularExpressionValidator rev
Repeater rp
RequiredFieldValidator rfv
Table tb
TableCell tc
TableRow tr
TextBox txt
ValidationSummary vs
XML XML
        
  b、html控件
html控件名 缩写
HtmlAnchor hah
HtmlButton hbtn
HtmlForm hform
HtmlGenericControl hgc
HtmlImage himg
HtmlInputButton(按钮) htxt
HtmlInputButton(重置) hrbtn
HtmlInputButton(提交) hcbtn
HtmlInputCheckBox hick
HtmlInputFile hifile
HtmlInputHidden hihidden
HtmlInputImage hiimg
HtmlInputRadioButton hirb
HtmlInputText(密码) hpwd
HtmlInputText(文本) hitxt
HtmlSelect hslt
HtmlTable htab
HtmlTableCell htc
HtmlTableRow htr
HtmlTextArea htxta
c.ADO.NET控件命名规范
类型 前缀 示例
Connection con conNorthwind
Command cmd cmdReturnProducts
Parameter parm parmProductID
DataAdapter dad dadProducts
DataReader dtr dtrProducts
DataSet dst dstNorthWind
DataTable dtbl dtblProduct
DataRow drow drowRow98
DataColumn dcol dcolProductID
DataRelation drel drelMasterDetail
DataView dvw dvwFilteredProducts


转载于:https://www.cnblogs.com/ywcz060/archive/2009/09/23/1572737.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值