/// <summary> /// Converts the metric distance to an imperial distance /// </summary> /// <param name="quantity">Quantity to convert</param> /// <param name="source">Source dimension</param> /// <param name="target">Target dimension</param> /// <returns>A new unit of measure with the quantity expressed in the target distance</returns> public IUnit <IDistance> VisitMetricDistance(double quantity, IMetricDistance source, IImperialDistance target) { var meters = source.ToMeters(quantity); var feet = meters * 3.2808398950131235; return(new DistanceUnit(target.FromFeet(feet), target)); }
/// <summary> /// Converts the imperial to imperial /// </summary> /// <param name="quantity">Quantity to convert</param> /// <param name="source">Source dimension</param> /// <param name="target">Target dimension</param> /// <returns>A new unit of measure with the quantity converted to the target dimension</returns> public IUnit <IDistance> VisitImperialDistance(double quantity, IImperialDistance source, IImperialDistance target) { var feet = source.ToFeet(quantity); return(new DistanceUnit(target.FromFeet(feet), target)); }