Parameter Naming Conventions
July 27th, 2006[ Geek ]
MSDN’s suggested naming conventions for parameter naming never really worked for me. My problem is that using camel case for parameters conflicts with their method level variable naming convention. That makes it difficult to easily distinguish between the two.
Which is great until you define a method level variable using the standard conventions:
Then later in the method, set it:
It’s not readily apparent that one of these is a parameter passed into the method rather than a method scoped variable. While I can’t stand the way it looks I’ve been dabbling with prefixing all parameters with “p”:
Resulting in this statement:
Now it’s quite clear what’s happening here, a method scope variable is being assigned a value that was passed in as a parameter. It works and solves this issue, however, I really really can’t stand the way the “p” prefix looks.