问题
The scope of my question is solely ASP.NET, as the answer may be different for Java and any other C based language.
How much overhead is involved when using the keyword "this" within a class to dereference a property? It seems that I've seen certain sources try to discourage the use of "this" for dereferencing, but generaly I've just ignored them until now.
回答1:
I think it is just a style issue. As stated in the answer to this question, the compiler injects 'this' into implicit uses of this. I would use it for clarity.
回答2:
StyleCop recommended using this for all instance field reference.
And when compared to access the said field through a property, shouldn't it actually be faster (albeit unnoticable) by bypassing abstraction?
回答3:
No overhead.
来源:https://stackoverflow.com/questions/1105386/overhead-when-using-keyword-this