So basically I came across some readonly properties on this one class, which the class author told me that I can make certain tasks possible. The problem is that most of the time they get their value through manipulation, and not directly from the private variable in the class.
Example:
public decimal? AccruedInterest { get { if (this.Result != null) { return this.GetExchangedCurrencyValue(this.Result.AccruedInterest.GetValueOrDefault(decimal.Zero)); } return null; } }
So, if I want to add a setter, I donโt want to worry about setting this Result object, because I'm not sure that if it returns, it will be drawn correctly.
Can I do something like this?
private decimal? _AccruedInterest; public decimal? AccruedInterest { get { if (this._AccruedInterest.HasValue) { return this._AccruedInterest.Value; } if (this.Result != null) { return this.GetExchangedCurrencyValue(this.Result.AccruedInterest.GetValueOrDefault(decimal.Zero)); } return null; } set { this._AccruedInterest = value; } }
Or do any of you see problems that may arise due to this (in addition to being changed now)?
source share