Closed koistya closed 8 years ago
I was quite interested in using 'this' instead of '_' to prefix the private members of the classes that I write.
However, Resharper and other modern code-refactoring tools, suggest prefixing '_' (underscore) to make sure that it is a private member of the class.
So, going forward, I think it is better to use ' ' (underscore) than using 'this'. Interestingly, we also type less code if we use a ' ' (underscore).
Hi guys, agreed about using '_'. This is pretty known standard which came from Microsoft if I'm correctly remember. And it is shorter and better noticeable if you're using editor w/o syntax highlight (but probably there are not so many guys use it).
What is your preferred code style from these two: (prefix private fields with
_
, then reference them without usingthis.
)or