Jump to content
Xtreme .Net Talk

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


Recommended Posts

Posted

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

  • *Experts*
Posted

Doesn't really matter, as long as you're consistance. When I use C#,

I use camel case for everything (camelCase) where the first letter

is small. I don't use hungarian notation at all in C#.

 

isValid, customerName, cancelButton, are all kinds of things that I

personally use. However, I believe that in the MSDN there is a list

of the hungarian notation conventions. From the top of my head:

 

Form frm

TextBox txt

Label lbl

Scrollbars hsc/vsc

Slider sld

Panel pnl (?)

Picture pic

Button btn

 

For variables, I use (these are not necessarily "official"):

String s

Numbers (any kind) i

Boolean b

Char c

  • *Experts*
Posted

If you have the Visual Studio help collection installed, check out

the article entitle "Coding Techniques." It contains numerous tips and

tricks for naming variables, methods, events, etc. etc.

 

This link is the article mentioned above; it may work:

http://ms-help://MS.VSCC/MS.MSDNVS/vsent7/html/vxconcodingtechniques.htm

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...