Variable naming and code conventions are often a difficult topic in a project, and programmers tend to use their personal naming conventions rather than others to prescribe how they write code.
However, having universal naming conventions is valuable when code needs to be read by other members of the team (especially when code is checked), and having a common naming convention makes it easier for you to read your code later. This experience after several projects, Experience more deeply. That's why you want to unify team naming rules.
has always been the most popular variable naming convention is the so-called Hungarian notation (Hungarian notation). Originally proposed by Charles Simonyi of Microsoft, And it has been in use for many years within Microsoft. This Convention provides a data type that represents a variable in a standard 3-or 4-letter prefix. For example, an integer variable that indicates the age of a student should be named Intstudentage.
with the above ideas, I will refer to the book, listed some variables of the naming rules, as follows:
variable naming convention
type
prefix
Example
Array
arr
arrstudentlist
Boolean
bln
Blnispostback
Byte
byt
Bytpixelvalue
Char
CHR
Chrname
DateTime
DTM
dtmStartTime
Decimal
Dec
Decaverageheight
Double
Dbl
Dblsizeofuniverse
Integer
int
Introwcount
Long
LNG
Lngincome
Object
obj
Cbjreturnvalue
Short
SHR
Shraverage
single
SNG
Sngmaximum
String
Str
StrName
Web control naming
type
prefix
Example
AdRotator
ADRT
Adrttopadv
Button
btn
btnsubmit
Calender
Cal
calmeetingdates
CheckBox
chk
Chkblue
CheckBoxList
CHKL
Chklcolorcontrols
Comaprevalidator
Valc
Valcvalidage
Customervalidator
Valx
Valxdbcheck
DataGrid
DGRD
Dgrdtitles
DataList
Dlst
Dlsttitles
DropDownList
Drop
Dropyear
HyperLink
lnk
lnkdetails
Image
img
Imgauntbetty
ImageButton
ibtn
Ibtnsubmit
Label
LBL
lblerrormess
LinkButton
lbtn
Lbtnsubmit
ListBox
LST
lstcountries
Panel
PNL
Pnlform
RadioButton
rad
Radfemale
RadioButtonList
rad
Radgender
RangeValidator
Valg
Valgage
RegularExpression
Vale
Valeemail
Repeator
rpt
Rptqueryresult
Requiredfeildvaildator
VALR
Valrname
Table
TBL
Tblcountrycode
TableCell
TBLC
Tblcchina
TableRow
Tblr
Tblrcountry
TextBox
txt
txtname
ValidationSummary
Vals
valsformerrors
XML
XMLC
Xmlctransformresult
placeholder
PLH
plhcontents
ado.net
type
prefix
Example
Connection
Con
Connorthwind
Command
cmd
cmdreturnproducts
Parameter
Parm
Parmid
DataAdapter
dad
dadproducts
DataReader
DTR
dtrproducts
DataSet
DST
dstproducts
DataTable
Dtbl
dtblproduct
DataRow
Drow
Drowrow
DataColumn
Dcol
Dcolproductid
DataRelation
Drel
Drelmasterdetail
DataView
DVW
dvwfilterproducts