0

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.

Jagd
  • 7,169
  • 22
  • 74
  • 107
  • Sorry for the dupe post. I tried firstly to find a question that was similar to mind, but the search didn't bring back anything relevant. – Jagd Jul 09 '09 at 17:43

3 Answers3

2

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.

Community
  • 1
  • 1
Xetius
  • 44,755
  • 24
  • 88
  • 123
0

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?

Adrian Godong
  • 8,802
  • 8
  • 40
  • 62
0

No overhead.

Jeremy Stein
  • 19,171
  • 16
  • 68
  • 83