Visual Studio C#的winform/webform/asp.net控件命名规范

控件命名规范

类型 前缀 示例
AdRotator adrt adrtTopAd
Button btn btnSubmit
Calendar cal calMettingDates
CheckBox chk chkBlue
CheckBoxList chkl chklFavColors
CompareValidator valc valcValidAge
CustomValidator valx valxDBCheck
DataGrid dgrd dgrdTitles
DataList dlst dlstTitles
DropDownList ddl ddlCountries
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控件命名规范

类型 前缀 示例
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

变量命名规范

类型 前缀 示例
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 窗体
Label

lbl

TextBox

tb

Button

btn

LinkButton

lb

HyperLink

hl

Repeator

rpt

ImageButton

ib

DropDownList

ddl

ListBox

lb

DataGrid

dg

DataList

dl

CheckBox

cb

CheckBoxList

cbl

RadioButton

rb

RadioButtonList

rbl

Image

img

Panel

pnl

Calender

cld

AdRotator

ar

Table

tbl

PlaceHolder

ph

Xml

xml

RequiredFieldValidator

rfv

CompareValidator

cv

RangeValidator

rv

RegularExpressionValidator

rev

ValidatorSummary

vs

CustomValidation

cv

Literal

ltl

TreeView

tv

数据
DataSet

ds

DataTable

dt

DataView

dv

SqlConnection

sc

SqlDataAdapter

sda

SqlCommand

sc

HTML
Label

lbl

Button

btn

Reset Button

rb

Submit Button

sb

Text Field

tf

Text Area

tr

File Field

ff

Password Field

pf

Checkbox

cb

Radio Button

rb

Hidden

hdn

Table

tbl

Flow Layout Panel

flp

Grid Layout Panel

glp

Image

img

Listbox

lb

常用词缩写
Argument

Arg

Maximum

Max

Buffer

Buf

Message

Msg

Clear

Clr

Minimum

Min

Clock

Clk

Multiplex

Mux

Compare

Cmp

Operating System

OS

Configuration

Cfg

Overflow

Ovf

Context

Ctx

Parameter

Param

Delay

Dly

Pointer

Ptr

Device

Dev

Previous

Prev

Disable

Dis

Priority

Prio

Display

Disp

Read

Rd

Enable

En

Ready

Rdy

Error

Err

Register

Reg

Function

Fnct

Schedule

Sched

Hexadecimal

Hex

Semaphore

Sem

High Priority Task

HPT

Stack

Stk

I/O System

IOS

Synchronize

Sync

Initialize

Init

Timer

Tmr

Mailbox

Mbox

Trigger

Trig

Manager

Mgr

Write

Wr

一些在软件中常用的反义词组

add/remove

begin/end

create/destroy

insert/delete

first/last

get/release

increment/decrement

put/get

add/delete

lock/unlock

open/close

min/max

old/new

start/stop

next/previous

source/target

show/hide

send/receive

source/destination

cut/paste

up/down

上一篇:ASP.NET Core2调用Azure云上的PowerBI报表展示


下一篇:UVA 11582 Colossal Fibonacci Numbers!【数学】