Codebanking.com Bank your code here...
HOME REGISTER TECHNICAL Q&A GENERAL Q&A SUBMIT CODE SNIPPET LOGIN
 
 Topics
 Tech Feeds
 Tech Fun


Naming conventions can be used in .Net

NAMING CONVENTIONS :

STYLE :
A consistent naming convention can also make Cde easier to read. There are essentially two forms of naming conventions in C#.
The first is pascal casing, where the first letter of each word in a name is capitalized, such as HelloWorld, DotProduct, or AmortizationSchedule. This is normally used in all instances except for parameters and private fields of classes.
In the case of private class fields and method parameters, use camel casing. This is where the first letter of the first word is lowercase and subsequent words are capitalized, such as bookTitle, employeeName, or totalCompensation.
This naming standard also helps to avoid creating bugs caused by type confusion and makes it easier to find these bugs later.
Database Naming Conventions :
Variables : camel Case

DataType
Choice -1
Choice – 2
char
chrFirstName
cFirstName
Integer
intQuantity
iQuantity
Date
dtDOB,dtRegister
dDob , dRegister
Bit
bitDebut
bDebug
Varchar
varAddress
vAddress
Text
txtHistory
tHistory
Float
fltAmount
fAmount
Double
dblValue
dblValue
Money
mnyPrice
mPrice
Table
tblTmpEmployee
tblTmpEmployee
 
 
 

Objects : camel Case

Object
Choice -1
Tabel    - (Pascal Case)
EmployeesMaster, CustomersMaster
Columns
iEmpID,vEmpFirstName,dEmpDOB
Views
v_FetchEmployees
Procedures
pr_FetchEmployees, pr_InsertEmployee, pr_UpdateEmplpyee, pr_DeleteEmployee
Index
idx_EmplID,idx_CustID
Primary key
pk_EmpCode,pk_CustCode
Foreign Key
fk_EmpDeptID
Constraints
chk_ValidEmpID
Rules
rul_ValidEmpID
Defaults
def_EmpSex
Functions
f_CalculateTotal
Triggers
tr_EmployeeUpdate

General Rules to Follow :
  • Don't Use complicated, long names for tables or other database objects. keep it simple
  • Prefer to use 'Mixed case' names instead of using underscores to separate two words of a name. However, when you use mixed case names, your developers should be consistent with case through out their code, on case sensitive SQL Servers
  • Use underscores only between the prefix/suffix and the actual object name. That is, never break the name of an object with underscores
  • Prefer not to use spaces within the name of database objects, as spaces confuse front-end data access tools and applications. If you must use spaces within the name of a database object, make sure you surround the name with square brackets (in Microsoft SQL Server) as shown here: [Order Details]
  • Make sure not using any reserved words for naming my database objects, as that can lead to some unpredictable situations. To get a list of reserved words for Microsoft SQL Server, search Books Online for 'Reserved keywords'
 
 
Asp / ASP.NET /C#  Naming Conventions :
Variables : camel Case

DataType
Choice -1
Choice – 2
String
strFirstName
sFirstName
Integer
intQuantity
iQuantity
Date
dtDOB,dtRegister
dDob , dRegister
Boolean
bolDebug
bDebug
 
 
 

Objects : camel Case

Component
Choice -1
Choice – 2
Connection
objConnecton
oConnection
Recordset
objRecordset
oRecordset
Command
objCommand
oCommand
DataSet
objDataSet
oDataSet
DataView
objDataView
oDataView
 
 
 

Controls : - camel Case

Control
Choice - 1
TextBox
txtFirstName
ComboBox
cboMonth
RadioButton
rdoSex
Password
pwdPassword
Button
cmdSave
Textarea
txtAddress
Image
imgPhoto
Label
lblName
File
fileUploadPhoto
RegularExpressions
reEmail
ValidationSummary
vsEmployee
Label
lblFirstName
DataList
dlEmployee
DataGrid
dgEmployee
PlaceHolder
phEmployee
Calender
calEmpDob
 
 
 
 

 
ASP.NET

Type
Standard
Example
Namespaces
Pascal Case, no underscores. Use CompanyName.TechnologyName as root.
AppliedIS.TimeCard.BusinessRules
IrritatedVowel.Controllers
PeteBrown.DotNetTraining.InheritanceDemoPeteBrown.DotNetTraining.Xml
Assemblies
If the assembly contains a single name space, or has an entire self-contained root namespace, name the assembly the same name as the namespace.
AppliedIS.TimeCard.BusinessRules.dll
IrritatedVowel.Controllers.dll
Classes and Structs
Pascal Case, no underscores or leading "C" or "cls".
Widget
InstanceManager
XmlDocument
Collection Classes
Follow class naming conventions, but add Collection to the end of the name
WidgetCollection
Delegate Classes
Follow class naming conventions, but add Delegate to the end of the name
WidgetCallbackDelegate
Exception Classes
Follow class naming conventions, but add Exception to the end of the name
InvalidTransactionException
Attribute Classes
Follow class naming conventions, but add Attribute to the end of the name
WebServiceAttribute
Interfaces
Follow class naming conventions, but start the name with "I" and capitalize the letter following the I
IWidget
Enumerations
Follow class naming conventions. Do not add "Enum" to the end of the enumeration name
SearchOptions
Functions and Subs
Pascal Case, no underscores except in the event handlers
C#: public void DoSomething(...)
 
 
 

 
                                                                                                           


Comments Posted:
No Comments Posted
Please login for leave your comments
 
 2010 codebanking.com      contactus@codebanking.com