public IotaAreaCode IncreasePrecision() { if (this.CodePrecision >= IotaAreaCodeDimension.Precision.Last()) { throw new Exception($"Precision can not be increased further than {this.CodePrecision}"); } this.Value = Precision.Calculate(this, IotaAreaCodeDimension.Precision[Array.IndexOf(IotaAreaCodeDimension.Precision, this.CodePrecision) + 1]); this.area = null; return(this); }
public IotaAreaCode SetPrecision(int precision) { if (!IotaAreaCodeDimension.Precision.Contains(precision)) { throw new ArgumentException($"Invalid precision. Allowed values are {string.Join(", ", IotaAreaCodeDimension.Precision)}"); } this.Value = Precision.Calculate(this, precision); this.area = null; return(this); }