c#命名规范,控件命名规则

NET命名规范

1、  命名空间

使用Pascal大小写,和类不要使用同样的名称,规则公司名+技术名称+功能

示例:AQH.BLL

2、  使用Pascal大小写,用名字或名字短语命名

示例:public class Button

3、  使用Pascal大小写,给接口名字加上字母I前缀

示例:public interface IServiceProvider

4、  属性Attribute

应该总是将后缀Attribute 添加到自定义属性类中

示例:public class ObsoleteAttribute

5、  枚举Enum

Enum类型与值使用Pascal大小写

6、  参数

使用Camel大小写

示例:GetType(string typeName)

      Format(string format)

7、  方法

使用动词命名方法,使用Pascal大小写

示例:RemoveAll() GetNextStudent()

8、  属性 Property

使用名字命名属性,使用Pascal大小写

9、  事件

使用EventHandler后缀,使用Pacal大小写

示例:public delegate void MouseEventHandler(object sender,MouseEventArgs e)

10、              常量 Const

所有动词大写,多个单词用下划线隔开

示例:public const string PACE_TITLE=”Welcome”;

11、              字段

Private 、protected 使用Camel大小写

Public使用Pacal大小写

控件简写对照表

Button

btn

btnSubmit

CheckBox

chk

chkBlue

CheckBoxList

chkl

chklBlue

DropDownList

drop

dropCatagory

HyperLink

lnk

lnkDetail

Image

img

imgPhone

Label

lbl

lblResults

Panel

pnl

pnlForm1

RadioButton

rad

radBlue

Repeater

rpt

rptQueryResult

Table

tbl

tblCategory

TextBox

txt

txtFirstName


原文地址:https://www.cnblogs.com/50614090/p/1959880.html