4 ms·
You've pointed out a distinction without a difference. On the back end C# properties are implemented as a pair of CLR methods named get_[PropertyName]() and se
by bunderbunder 11y ago
You've pointed out a distinction without a difference.
On the back end C# properties are implemented as a pair of CLR methods named get_[PropertyName]() and set_[PropertyName](). The rest is syntactic sugar. So when you "simply modify the price getter", what you're doing is simply modifying the implementation of a method named get_Price().
- dimgl 11y agoRight, but the article is arguing the inconvenience of having to make such methods across all classes that derive from a superclass. If this is inherently provided in the language then I would say that language doesn't suffer from the issue discussed in this article. And that language I'm speaking of is C#.
- manyxcxi 11y agoWith respect to Java, the getters and setters are automatically generated in an IDE if you want, so it's not all so bad. And if you get to a spot where your getter and setter needs to do more than spit out the value or assign it for some reason, you're really at the same amount of code. It is definitely nice in C# not having to LOOK at all the damn getters and setter though.