C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Tips » General »

Coding Guidlines - Naming Conventions


Posted Date: 14 Sep 2009    Resource Type: Tips    Category: General
Author: chiragMember Level: Gold    
Rating: 1 out of 5Points: 3



Following are naming conventions one should follow as best practice.


1.Use Pascal casing for Class names

public class HelloWorld
{
...
}

2. Use Pascal casing for Method names

void SayHello(string name)
{
...
}


3.Use Camel casing for variables and method parameters

int totalCount = 0;
void SayHello(string name)
{
string fullMessage = "Hello " + name;
...
}

4. Use the prefix “I” with Camel Casing for interfaces ( Example: IEntity )

5. Do not use Hungarian notation to name variables.

All variables should use camel casing.

6. Use Meaningful, descriptive words to name variables. Do not use abbreviations.

Good:

string address
int salary

Not Good:

string nam
string addr
int sal

7. Do not use single character variable names like i, n, s etc. Use names like index, temp

One exception in this case would be variables used for iterations in loops:

for ( int i = 0; i < count; i++ )
{
...
}

8. Do not use underscores (_) for local variable names.

9. All member variables must be prefixed with underscore (_) so that they can be identified from other local variables.

10. Do not use variable names that resemble keywords.



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Naming Convention  .  Coding Guidlines  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Tips to Reduce Gmail Memory Space and its Better Management in Outlook
Previous Resource: Extract ISO Format Files without nero
Return to Discussion Resource Index
Post New Resource
Category: General


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use