View Full Version : C# Properties
09-20-2010, 10:56 AM
It's been a little while since I've coded in C#...I can't remember if it's good practice (or legal) to call class methods or even reference other class properties inside of a class property (all methods and properties are within the same class)....Anyone?
09-20-2010, 06:50 PM
You can definitely do it and it is up to you if you want to or not. I personally try and keep properties small since they are meant to be setters and getters.
09-20-2010, 07:35 PM
I personally try and keep properties small since they are meant to be setters and getters.
I do too usually, but occasionally a setter entails more than just assigning a value -- I need to modify that value first. This usually occurs when I have a method whose purpose is to get or set something, so my inclination is to refactor that as a property -- at the expense of possibly adding a larger-than-usual amount of logic to the new property.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.