I am looking to have an array property return the calculation of 2 other arrays at the same index (this has been answered using zip in another question Array property returns calculation of 2 other arrays). But now I have to set the value of the calculation.
public ushort[] LowLimit{ get; set; }
public ushort[] Range{ get; set; }
public ushort[] HiLimit => LowLimit.Zip(Range, (l,r) => (ushort)(l + r)).ToArray();
ie. if I set HiLimit[0], Range would be set to (value - LowLimit), how is this possible? Both getter and setter are required.
EDIT (2017-02-09): I have marked @dasblinkenlight answer as correct because its not possible. The reason I need this is because I am communicating with a device that sends a low limit and a range but the software allow the user to read and edit a low limit and high limit. The high and low limit are bound to controls on the display so I used properties for those and made two methods for setting and getting a range when communicating to the device.
public ushort[] LowLimit{ get; set; } = new ushort[8];
public ushort[] HighLimit{ get; set; } = new ushort[8];
public ushort getRange(int index) {
ushort range = 0;
if(index < 8)
range = (ushort)(HighLimit[index] - LowLimit[index]);
return range;
}
public void setRange(int index, ushort value) {
if (index < 8)
HighLimit[index] = (ushort)(LowLimit[index] + value);
}