global vars names
-
Is there some kind of a rule where global variables should have "_" before their names. For example: _MyGlobalVar
-
Is there some kind of a rule where global variables should have "_" before their names. For example: _MyGlobalVar
No. It's just one of many different conventions that have come and gone. For a while, this was suggested as a standard by Microsoft, but they no longer recommend this.
I'm not a stalker, I just know things. Oh by the way, you're out of milk.
Forgive your enemies - it messes with their heads
-
Is there some kind of a rule where global variables should have "_" before their names. For example: _MyGlobalVar
To add to Petes' answer: there are no global variables in C# anyway. Every variable is part of a class...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
-
Is there some kind of a rule where global variables should have "_" before their names. For example: _MyGlobalVar
Absolutely not, I would never do that. IMO identifier names should be easily readable and pronounceable, no special characters, no Hungarian notation. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
-
Is there some kind of a rule where global variables should have "_" before their names. For example: _MyGlobalVar
Contrarywise; there is a rule against global variables. But to heck with what other people call "rules"; do whatever you darn well please. Just be consistent. And if your organization has a coding standard, follow it.
-
Is there some kind of a rule where global variables should have "_" before their names. For example: _MyGlobalVar
TCPMem wrote:
Is there some kind of a rule where global variables should have "_" before their names
No there is no some kind of rule where global variables should have "_". "_" is one of the symbol which can be used defining variable name. you need to only follow the standard rule made for declaring Variable Name.