public double GetValue(IBxUnit unit) { if (unit.BaseUnitCate != Unit.BaseUnitCate) { throw new Exception("Unit Category is not Matching!"); } return(Unit.EMConverTo(Value, unit)); }
public void ChangeUnit(IBxUnit unit) { if (Unit != null) { if (Unit.Category != unit.Category) { throw new Exception("can not switch unit between diffrent unit category!"); } _value = Unit.EMConverTo(_value, unit); Unit = unit; } }