coding style - What is a good rule for when to prepend members with 'this' (C#)? -


if accessing member field, property, or method, i'm never sure when should prepend 'this'.

i not asking cases required, in case local variable has same name. talking cases meaning same. more readable? there standards, best practices, or rules of thumb should following? should consistent throughout class, or entire code base?

i recommend using microsoft's guidelines, verified stylecop: http://blogs.msdn.com/sourceanalysis/

the general rule is, prepend members "this." when defined in class, unless static, in case cannot.

here rule directly stylecop:

sa1101: call {method or property name} must begin 'this.' prefix indicate item member of class. 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -