C# Web编码规则

摘录自胡子随想的Blog,由于不知道怎么使用TrackBack ,所以就直接copy过来了,对原作者说声抱歉了
原文地址:http://coolbo.blogbus.com/logs/2005/10/1542477.html

编码规则

<!--[if !supportLists]-->1. <!--[endif]--> NameSpace

<!--[if !supportLists]--> <!--[endif]-->公司名.品名[.件名的复数]

<!--[if !supportLists]--> <!--[endif]-->Ms.Office

<!--[if !supportLists]-->2. <!--[endif]-->

<!--[if !supportLists]--> <!--[endif]--> [Class]

<!--[if !supportLists]-->n <!--[endif]-->FormForm | Class MainForm

<!--[if !supportLists]-->n <!--[endif]-->WebPage | Class ProductListPage

<!--[if !supportLists]-->n <!--[endif]-->或者名 | Class Indicator

<!--[if !supportLists]-->n <!--[endif]-->当类是特性Attribute | Class CauseExceptionAttribute

<!--[if !supportLists]-->n <!--[endif]-->当类Exception | Class ColorSetException

<!--[if !supportLists]-->n <!--[endif]-->当类只作Base | Class IndicatorBase

<!--[if !supportLists]-->n <!--[endif]-->当类存在一个实例(全局类类)以Class | Class ApplicationSystemClass

<!--[if !supportLists]-->n <!--[endif]-->不要使用下划线

<!--[if !supportLists]-->n <!--[endif]-->少用缩写

<!--[if !supportLists]--> <!--[endif]--> [Enum]

<!--[if !supportLists]-->n <!--[endif]-->以名或名命名

<!--[if !supportLists]-->n <!--[endif]-->复数结

<!--[if !supportLists]-->n <!--[endif]-->Colors Keys

<!--[if !supportLists]--> <!--[endif]-->接口 [Interface ]

<!--[if !supportLists]-->n <!--[endif]-->I用形容命名

<!--[if !supportLists]-->n <!--[endif]-->Interface ISortable

<!--[if !supportLists]--> <!--[endif]-->结构 [Structure ]

<!--[if !supportLists]--> <!--[endif]-->委托 [Delegate ]

<!--[if !supportLists]-->n <!--[endif]-->以描述作的名命名

<!--[if !supportLists]-->n <!--[endif]-->用于事件理的委托型,必EventHandler

<!--[if !supportLists]-->3. <!--[endif]-->方法&

<!--[if !supportLists]--> <!--[endif]-->方法 [Method]

<!--[if !supportLists]-->n <!--[endif]-->动词动词命名

<!--[if !supportLists]--> <!--[endif]--> [Property]

<!--[if !supportLists]-->n <!--[endif]-->性以简洁清晰的名命名

<!--[if !supportLists]--> <!--[endif]-->事件 [Event]

<!--[if !supportLists]-->n <!--[endif]-->命名的原一般是动词动词的分,通过时态表明事件生的时间

<!--[if !supportLists]-->4. <!--[endif]-->&常数

<!--[if !supportLists]--> <!--[endif]--> [Const]

<!--[if !supportLists]-->n <!--[endif]-->以表明常的名命名,一般不分常

<!--[if !supportLists]-->n <!--[endif]-->全部使用大字母 | Const String DEFAULT_NAME

<!--[if !supportLists]-->n <!--[endif]-->字之用下划线分隔

<!--[if !supportLists]--> <!--[endif]--> [Variable]

<!--[if !supportLists]-->n <!--[endif]-->用有意的名字命名即可

<!--[if !supportLists]-->n <!--[endif]-->用相应简写开头

<!--[if !supportLists]-->n <!--[endif]-->Private String strCustomerName

<!--[if !supportLists]-->n <!--[endif]-->Private int iCustomerCount

<!--[if !supportLists]-->n <!--[endif]-->常用数缩写

bool b

Array arr

Byte byt

Char chr

DateTime dtm

Decimal dec

Double dbl

int i

Long lng

Object obj

Short shr

Single sng

String str

<!--[if !supportLists]-->n <!--[endif]-->性所对应

m_开头 | Private String m_ProductName

private String m_ProductName

 

public String ProductName

{

 get

 {

 retrun m_ProductName;

 }

}

<!--[if !supportLists]-->n <!--[endif]-->不要使用原义数字或原字符串

例如

for(int i = 50;i < 100;i ++)

{

 MessageBox.Show(i.ToString());

}

应该如此:

for(int i = iStart;i < iEnd;i ++)

{

 MessageBox.Show(i.ToString());

}

<!--[if !supportLists]-->n <!--[endif]-->使用命名常

<!--[if !supportLists]-->n <!--[endif]-->常用控件缩写

Label lbl

Button btn

LinkButton lnk

TextBox txt

CheckBox chk

ListBox lst

DropDownList drp

DataGrid dgrd

More ...

<!--[if !supportLists]-->5. <!--[endif]--> [commentary]

<!--[if !supportLists]--> <!--[endif]-->的注

<!--[if !supportLists]-->n <!--[endif]-->

/// <summary>

/// DataAccess

/// 赖关: System.Data,System.Data.SqlClient

/// 目的:实现数据操作

/// 参数

/// 建人:Coolbo

/// 时间2005-10-26

/// 据返回应该再完善些

/// </summary>

名称

赖关

目的

作者

参数

最后编辑

最后编辑时间

注释

<!--[if !supportLists]-->n <!--[endif]-->的修改

/// <summary>

/// DataAccess

/// 赖关: System.Data,System.Data.SqlClient

/// 目的:实现数据操作

/// 参数

/// 建人:Coolbo

/// 时间2005-10-26

/// 据返回应该再完善些

/// 修改描述:用SqlClient替代了原OLEDB操作

/// 修改者:Kevin

/// 修改日期:2005-11-20

/// </summary>

修改描述

修改者

修改日期

<!--[if !supportLists]--> <!--[endif]-->类属

/// <summary>

/// 性的描述

/// </summary>

<!--[if !supportLists]--> <!--[endif]-->方法

/// <summary>

/// 对类方法的明性描述

/// </summary>

/// <param name="参数">参数说</param>

/// <returns>

/// 方法返回明,该说明必明确明返回的代表什

/// </returns>

<!--[if !supportLists]-->n <!--[endif]-->

<!--[if !supportLists]-->n <!--[endif]-->参数

<!--[if !supportLists]-->n <!--[endif]-->参数说明

<!--[if !supportLists]-->n <!--[endif]-->方法返回明,该说明必明确明返回的代表什

<!--[if !supportLists]--> <!--[endif]-->码间说

<!--[if !supportLists]-->n <!--[endif]-->中遇到块时添加注if,for,foreach,……,添加的注够说明此的作用和实现手段(所用算法等等

<!--[if !supportLists]-->6. <!--[endif]-->格式

<!--[if !supportLists]--> <!--[endif]-->缩进Tab缩进,使用vs

<!--[if !supportLists]--> <!--[endif]-->在代中垂直对齐左右括()除外

for(int i = 0;i < 10;i ++)

{

 MessageBox.Show(i.ToString());

}

<!--[if !supportLists]--> <!--[endif]-->行代或者注不得超1024*768分辨率下的一

<!--[if !supportLists]--> <!--[endif]-->一行被分几行,通过将联运算符放在每一行的末尾而不是开头

<!--[if !supportLists]--> <!--[endif]-->每一行上放置的句避免超

<!--[if !supportLists]--> <!--[endif]-->在大多数运算符之前和之后使用空格 | int i = i + k;

<!--[if !supportLists]--> <!--[endif]-->大的复杂码节为较小的、易于理解的模

<!--[if !supportLists]--> <!--[endif]-->编写 SQL 关键字使用全部大元素(如表、列和视图)使用大小混合

<!--[if !supportLists]--> <!--[endif]-->主要的 SQL 子句放在不同的行上

SELECT FirstName, LastName

FROM Customers

WHERE State = 'WA'

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值