SwDevMan81
2010-08-19 20:58:06
views:
78answers:
4
A:
Please vote to close rather than posting the dupe link as an answer. Thanks!
Jon B
2010-08-19 20:59:48
@Jon B - I <3 Rep. Besides, people with more Rep/should know even better than me still answer these questions and get Rep for it....
SwDevMan81
2010-08-19 21:01:47
@SwDevMan81: Often the duplicate is deleted, in which case the reputation earned is lost again.
Mark Byers
2010-08-19 21:03:11
@Mark Byers - For serious? Good to know.
SwDevMan81
2010-08-19 21:03:59
@SwDevMan81: And don't worry - I won't actually get any reputation for my answer anyway as I have already passed the reputation cap for today.
Mark Byers
2010-08-19 21:04:55
@Mark Byers - Im jealous
SwDevMan81
2010-08-19 21:09:12
@SwDevMan81: And I agree with you find an exact duplicate it ought to generate reputation, but currently that is not the case. You might want to vote up this question on meta: http://meta.stackoverflow.com/questions/37466/give-an-incentive-for-finding-duplicate-questions
Mark Byers
2010-08-19 21:15:08
@Mark Byers - oooo I like it, upvoted... and you got me 100 extra rep for signing into meta haha, score.
SwDevMan81
2010-08-19 21:21:52
+3
A:
In that specific example there is no difference - it will compile to identical bytecode.
It only makes a difference if there is a local variable or parameter with the same name as the method you want to call, in which case you need to write this
to refer to the member and not the local variable.
Mark Byers
2010-08-19 20:58:33
A:
There is no difference from an execution standpoint. As you imply, some people use this, some don't.
Use the standard you've decided is correct, unless you are overridden by company standards.
automatic
2010-08-19 20:59:06
A:
Not performance, they will compile to the same IL.
The thing with the this
keyword is that it you don't have local variables with the same naming as the class members.
private void MyMethod2()
{
Action MyMethod1 = MyMethod2;
MyMethod1(); // recursive call to MyMethod2
this.MyMethod1(); // call to real MyMethod1
}
Other than that some people like it, some does not. Follow the code standard in your team.
Albin Sunnanbo
2010-08-19 21:00:35