Namespace standard:
We must be use namespace: Com. [companyname]. [projectname].[modulename]
For example: Com.Codespacies.PIS.Recordmgt.Form
We must separate cs file like
this:
Form: cs form
Dao: database integration and
business logic
Rpt: crystal report file
Model: model class
Dataset: dataset file
Documentation Comments:
This pattern for class
comments:
/// <summary>
/// This class...
/// created by:
/// created Date:
/// modified by:
/// modified Date:
/// Description:
/// </summary>
This pattern for method
comments:
/// <summary>
/// this method...
/// Description:
/// ref parameter:
/// </summary>
This pattern for change
comments:
/// <summary>
/// why change...
/// Description:
/// Date:
/// requested by:
/// </summary>
Capitalization Styles:
Pascal Case
The first letter in the
identifier and the first letter of each subsequent concatenated word are capitalized. You can use Pascal case for identifiers of
three or more characters.
For example: BackColor
Camel Case
The first letter of an
identifier is lowercase and the first letter of each subsequent concatenated
word
is capitalized.
For example: backColor
Uppercase
All letters in the identifier
are capitalized. Use this convention
only for identifiers that consist of two
or fewer letters.
For example:
System.IO
System.Web.IO
You might also have to
capitalize identifiers to maintain compatibility with existing, unmanaged symbol
schemes, where all uppercase characters are often used for enumerations and
constant values. In general, these
symbols should not be visible outside of the assembly that uses them.
Class Naming Guidelines
·
Class names must be nouns or noun phrases.
·
UsePascal Casing
·
Do not use any class prefix
Interface Naming Guidelines
·
Name interfaces with nouns or noun phrases or
adjectives describing behavior. (Example IComponent or IEnumberable)
·
Use Pascal Casing
·
Do not use any Interface prefix
Enum Naming Guidelines
·
Use Pascal Casing for enum value names and enum
type names
·
Don’t prefix (or suffix) a enum type or enum
values
·
Use singular names for enums
·
Use plural name for bit fields.
ReadOnly and Const Field Names
·
Name static fields with nouns, noun phrases or
abbreviations for nouns
·
Use Pascal Casing
Parameter/non const field Names
·
Do use descriptive names, which should be enough
to determine the variable meaning and it’s type. But prefer a name that’s based
on the parameter’s meaning.
·
Use Camel Casing
Variable Names
·
Counting variables are preferably called i, j,
k, l, m, n when used in 'trivial' counting loops.
·
Use Camel Casing
Method Names
·
Name methods with verbs or verb phrases.
·
Use Pascal Casing
Property Names
·
Name properties using nouns or noun phrases
·
Use Pascal Casing
·
Consider naming a property with the same name as
it’s type
Event Names
·
Name event handlers with the EventHandler
suffix.
·
Use two parameters named sender and e
·
Use Pascal Casing
·
Name event argument classes with the EventArgs
suffix.
·
Name event names that have a concept of pre and
post using the present and past tense.
·
Consider naming events using a verb.
Table of capitalization summary
|
Identifier
|
Case
|
Example
|
|
Class
|
Pascal
|
AppDomain
|
|
Struct
|
Pascal
|
EmpInfo
|
|
Enum
type
|
Pascal
|
ErrorLevel
|
|
Enum
values
|
Pascal
|
FatalError
|
|
Event
|
Pascal
|
ValueChange
|
|
Exception
Class
|
Pascal
|
WebException
Note:
Always ends with the suffix Exception
|
|
Read-only
Static field
|
Pascal
|
RedValue
|
|
Interface
|
Pascal
|
IDisposable
Note:
Always begins with the prefix I
|
|
Method
|
Pascal
|
ToString
|
|
Namespace
|
Pascal
|
System.Drawing
|
|
Parameter
|
Camel
|
typeName
|
|
Property
|
Pascal
|
BackColor
|
|
Protected
instance field
|
Camel
|
redValue
Note:
Rarely used. A property is preferable
to using a protected instance field
|
|
Public
instance field
|
Pascal
|
RedValue
Note:
Rarely used. A property is preferable is using a instance fied.
|
|
Private
instance field
|
Camel
|
redValue
|
Table of Standard Control Prefixes
|
Control
|
Prefix
|
Example
|
|
Label
|
lbl
|
lblName
|
|
LinkLabel
|
llbl
|
llblName
|
|
Button
|
btn
|
btnName
|
|
Textbox
|
txt
|
txtName
|
|
MainMenu
|
mnu
|
mnuName
|
|
CheckBox
|
chk
|
chkName
|
|
RadioButton
|
rdo
|
rdoName
|
|
GroupBox
|
grp
|
grpName
|
|
PictureBox
|
pic
|
picName
|
|
Grid
|
grd
|
grdName
|
|
ListBox
|
lst
|
lstName
|
|
ComboBox
|
cmb
|
cmbName
|
|
ListView
|
lstv
|
lstvName
|
|
TreeView
|
tre
|
treName
|
|
TabControl
|
tab
|
tabName
|
|
DateTimePicker
|
dtp
|
dtpName
|
|
MonthCalendar
|
mon
|
monName
|
|
ScrollBar
|
sbr
|
sbrName
|
|
Timer
|
tmr
|
tmrName
|
|
Splitter
|
spl
|
splName
|
|
DomainUpDown
|
dud
|
dudName
|
|
NumericUpDown
|
nud
|
nudName
|
|
TrackBar
|
trk
|
trkName
|
|
ProgressBar
|
pro
|
proName
|
|
RichTextBox
|
rtxt
|
rtxtName
|
|
ImageList
|
img
|
imgName
|
|
HelpProvider
|
hlp
|
hlpName
|
|
ToolTip
|
tip
|
tipName
|
|
ContextMenu
|
cmnu
|
cmnuName
|
|
ToolBar
|
tbr
|
tbrName
|
|
Form
|
frm
|
frmName
|
|
StatusBar
|
bar
|
barName
|
|
NotifyIcon
|
nico
|
nicoName
|
|
OpenFileDialog
|
ofd
|
ofdName
|
|
SaveFileDialog
|
sfd
|
sfdName
|
|
FontDialog
|
fd
|
fdName
|
|
ColorDialog
|
cd
|
cdName
|
|
PrintDialog
|
pd
|
pdName
|
|
PrintPreviewDialog
|
ppd
|
ppdName
|
|
PrintPreviewControl
|
ppc
|
ppcName
|
|
ErrorProvider
|
err
|
errName
|
|
PrintDocument
|
pdoc
|
pdocName
|
|
PageSetupDialog
|
psd
|
psdName
|
|
CrystalReportViewer
|
crv
|
crvName
|
|
PrintDialog
|
pd
|
pdName
|
|
FileSystemWatcher
|
fsw
|
fswName
|
|
EventLog
|
log
|
logName
|
|
DirectoryEntry
|
dire
|
direName
|
|
DirectorySearcher
|
dirs
|
dirsName
|
|
MessageQueue
|
msq
|
msqName
|
|
PerformanceCounter
|
pco
|
pcoName
|
|
Process
|
pro
|
proName
|
|
ServiceController
|
ser
|
serName
|
|
ReportDocument
|
rpt
|
rptName
|
|
DataSet
|
ds
|
dsName
|
|
Datatable
|
dt
|
dtName
|
|
OleDbDataAdapter
|
olea
|
oleaName
|
|
OleDbConnection
|
olec
|
olecName
|
|
OleDbCommand
|
oled
|
oledName
|
|
SqlDbDataAdapter
|
sqla
|
sqlaName
|
|
SqlDbConnection
|
sqlcon
|
sqlconName
|
|
SqlDbCommand
|
sqlcmd
|
sqlcmdName
|
|
DataView
|
dvw
|
dvwName
|
Table of Standard Data Type Prefixes
|
Data
Type
|
Prefix
|
Example
|
|
int
|
i
|
iValueName
|
|
uint
|
ui
|
uiValueName
|
|
string
|
str
|
strValueName
|
|
double
|
d
|
dValueName
|
|
long
|
l
|
lValueName
|
|
ulong
|
ul
|
ulValueName
|
|
bool
|
b
|
bValueName
|
|
char
|
c
|
cValueName
|
|
decimal
|
dec
|
decValueName
|
|
float
|
f
|
fValueName
|
|
byte
|
y
|
yValueName
|
|
sbyte
|
sy
|
syValueName
|
|
short
|
s
|
sValueName
|
|
ushort
|
us
|
usValueName
|
|
object
|
obj
|
objValueName
|
|
Exception
|
ex
|
|
Table of Standard Control Prefixes
|
Control
|
Prefix
|
Example
|
|
DataGrid
|
dtg
|
dtgName
|
|
Column
|
col
|
colName
|
|
|
|
|
|
|
|
|
|
|
|
|
Design
Every form has message level which gives any message