4 ms·
I don't advocate for using base instead of this. I advocate using base for base. I advocate against using this, as does Visual Studio 2017 and above [1]. 1:
by jermaustin1 6y ago
I don't advocate for using base instead of this.
I advocate using base for base.
I advocate against using this, as does Visual Studio 2017 and above [1].
1: https://i.imgur.com/9F6Lyx8.png https://i.imgur.com/9F6Lyx8.png
- bradjohnson 6y agoYou're advocating using base.foo() rather than this.foo() which is not equivalent behaviour and is bad advice.
- jermaustin1 6y agoIncorrect. I am advocating that if you want to signify you are using the base classes method, use base. Otherwise don’t use base or this.
- mypalmike 6y agoCalling a method on base besides the method you are overriding is a rather malodorous code smell. It's saying "I want to invoke a method on this instance, but with behavior that differs from how it's defined for this instance".
- jermaustin1 6y agoIn the post I mentioned that the manager wanted developer to use "this." to signify that they were using the base class's method. Which isn't correct. Lets say someone were to come in and override the base class's method, now calling this.SomeMethod() would not be the intended behavior of the original code that was improperly using "this." as "base." I don't want "base." or "this." in my code at all unless there is some incredibly rare case that I MUST use it.