Naming conventions in .NET

SoftwareEng

Senior member
Apr 24, 2005
553
4
81
Microsoft has been actively discouraging the use of underscores in function and variable names in .NET, yet in VB.NET almost all event handlers contain underscores:

cmdMakeLove_Click
cboGirls_SelectedIndexChanged

etc. What's up with that?
 

KB

Diamond Member
Nov 8, 1999
5,406
389
126
Microsft discourages using _ as the first letter of a variable/function. C++ programmers often use _ to signal that a variable is a member variable.

They also discourage using prefixes like cbo for combo boxes (Hungarian Notation).

But who cares! As long as you make it a standard across your whole application, do what makes sense to you.
 

Stuxnet

Diamond Member
Jun 16, 2005
8,392
1
0
The lack of conventions in .NET drive me nuts. I'm anal as hell when it comes to code, and a lack of conventions means having to constantly train and monitor developers to make sure everyone is on the same page. Instead of making loose, incomplete, and ambiguous recommendations, it would be nice if Microsoft put forth a standards document that everyone could point to and say "that's how it's done".
 

oog

Golden Member
Feb 14, 2002
1,721
0
0
microsoft did put forth a standards document. it's on msdn. it's specific to building .net class libraries though.