ASP.NET通用类型前缀约定列表

2010-08-28 10:47:53来源:西部e网作者:

Stephen Walther的《ASP.NET揭秘》(第二版)是我学习ASP.NET最重要的一本教材,在书的前言中,Stephen Walther列出了ASP.NET通用类型前缀约定,西部E网的icech觉得对初学或者开发中规范用法非常有帮助,就整理出来给大家,希望大家喜欢!

变量命名约定表(Table . Variable Naming Conventions)

类型

前缀

例子

Array

arr

arrShoppingList

Boolean

bln

blnIsPostBack

Byte

byt

bytPixelValue

Char

chr

chrDelimiter

DateTime

dtm

dtmStartDate

Decimal

dec

decAverageHeight

Double

dbl

dblSizeOfUniverse

Integer

int

intRowCounter

Long

lng

lngBillGatesIncome

Object

obj

objReturnValue

Short

shr

shrAverage

Single

sng

sngMaximum

String

str

strFirstName

Web控件表(Table . WebControls)

类型

前缀

例子

AdRotator

adrt

adrtTopAd

Button

btn

btnSubmit

Calendar

cal

calMeetingDates

CheckBox

chk

chkBlue

CheckBoxList

chkl

chklFavColors

CompareValidator

valc

valcValidAge

CustomValidator

valx

valxDBCheck

DataGrid

dgrd

dgrdTitles

DataList

dlst

dlstTitles

DropDownList

drop

dropCountries

HyperLink

lnk

lnkDetails

Image

img

imgAuntBetty

ImageButton

ibtn

ibtnSubmit

Label

lbl

lblResults

LinkButton

lbtn

lbtnSubmit

ListBox

lst

lstCountries

Panel

pnl

pnlForm2

PlaceHolder

plh

plhFormContents

RadioButton

rad

radFemale

RadioButtonList

radl

radlGender

RangeValidator

valg

valgAge

RegularExpression

vale

valeEmail_Validator

Repeater

rpt

rptQueryResults

RequiredFieldValidator

valr

valrFirstName

Table

tbl

tblCountryCodes

TableCell

tblc

tblcGermany

TableRow

tblr

tblrCountry

TextBox

txt

txtFirstName

ValidationSummary

vals

valsFormErrors

XML

xmlc

xmlcTransformResults

ADO.NET表(Table . ADO.NET)

类型

前缀

例子

Connection

con

conNorthwind

Commmand

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

注:转载请注明西部E网整理。

关键词:ASP.NET