Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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?

No overhead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top