Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code guidline / code convention / naming convention for C#??

Status
Not open for further replies.

gicio

Programmer
Jun 18, 2002
39
DE
looking for something like a code guidline....

i.e. that a TextBox should have the prefix: txt


TextBox --> txt i.e. txtCustomer

Label --> lbl i.e. lblCustomer

String --> str i.e. strCustomer

bool --> boo i.e. booIsValide



is something like that anywhere available?




gicio
 
For forms (both Win & Web), I've been using the old VB6 prefixes (txt, lbl, cbo, cmd, etc). It seems to work well.

For variable naming, Microsoft now recommends dropping any datatype prefixes (aka Hungarian Notation), and using more descriptive names for your variables. So, "LastName", not "sLastName". The thinking is that Intellisense makes the prefixes obsolete.

They also recommend that public members and methods be named using PascalCase ("AddUser()", not "addUser()"). Private members should be named using CamelCase ("lastName", not "LastName"). This is OK because they're private, and won't be called by other .NET languages which are case-insensitive (like VB.NET).

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top