Skip to main content
2 of 3
edited tags

Why did Microsoft make parameters, local variables and private fields have the same name naming convention?

I asked this question quite some time ago: http://programmers.stackexchange.com/questions/1890/how-do-you-name-your-private-variables-in-c

In one of the answers, I was pointed to Microsoft's MSDN page that shows that private variables/fields should be named like this:

private int myInteger; 

But a parameter would be:

void SomeMethod(int myInteger) 

and a local variable would be like this:

int myInteger; 

So when you reference them like this

myInteger = 10; 

you have no way of knowing which one you are talking about.

I am now starting a new project and one of my co-workers is asking me why we don't do something to differentiate at least some of these.

I am wondering the same thing. Why didn't Microsoft's standard keep these different?

Vaccano
  • 4.1k
  • 5
  • 35
  • 39