/// <summary> /// Translates from an internal height unit to a JavaScript height unit. /// </summary> /// <param name="heightUnit"></param> /// <returns></returns> private static string GetHeightUnit(HeightUnit heightUnit) { switch (heightUnit) { case HeightUnit.Feet: return("f"); case HeightUnit.Metres: return("m"); default: throw new NotImplementedException(); } }
/// <summary> /// Returns a description of a height unit. /// </summary> /// <param name="heightUnit"></param> /// <returns></returns> public static string HeightUnit(HeightUnit heightUnit) { switch (heightUnit) { case Interface.HeightUnit.Feet: return(Strings.Feet); case Interface.HeightUnit.Metres: return(Strings.Metres); default: throw new NotImplementedException(); } }
public double GetHeight(HeightUnit unit) { switch (unit) { case HeightUnit.Cm: return(Height); case HeightUnit.Meter: return(Height / 100); case HeightUnit.Feet: return(Height * 0.0328); default: throw new NotSupportedException($"Height unit {unit} not supported"); } }
public PassportHeight(string input) { if (input.EndsWith("cm")) { Unit = HeightUnit.Centimeter; } else { Unit = HeightUnit.Inch; } Height = Convert.ToInt32(input.Substring(0, input.Length - 2)); }
public HeightWithUnit(double height, HeightUnit unit) { this.Num = height.ToString(); this.Unit = unit; }
public HeightWithUnit(string str, HeightUnit height) { this.Num = str; this.Unit = height; }
public HeightContainer(double height, HeightUnit metric) { Height = height; Metric = metric; }