views:

206

answers:

1
+7  A: 

IMHO, the this is a very useful keyword. Once I see the "this", I know it is a class variable. Otherwise, I would have to check whether its a parameter, a variable declared within the method. "This" saves time :) (ambiguous joke hehe)

Samuel Carrijo
+1 One of the things I wonder is why many people and even some code analysis tools recommend not to use "this".
Rui Craveiro
Yeah, I've come to think is is sensible practice, too. I'm in the habit of using the keyword on all class variables and properties (not methods of course!), since it's somewhat more elegant than the underscore prefix.
Noldorin
It's easier to just name member variables using a prefix like "m_" for instance.
Zack
Using "m_" has some issues. It makes code a little more dirty, and it requires who reads the code to know this convention (higher learning curve).Anyone who sees "this" will immediately know what that means (hopefully)
Samuel Carrijo