Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use "this" to call class properties, members, or methods?

Tags:

I've seen some guides or blogs that say using this to access a class's own members is bad. However, I've also seen some places where professionals are accessing with this. I tend to prefer explicitly using this, since it seems to make it clear that the thing I'm accessing is part of the class.

this.MyProperty = this.GetSomeValue();

Is there some advantage or disadvantage to using this? Is it simply a stylistic preference?