//======================================================================= #region -= static methods =- /// <summary> /// Must be in the format -398.2,M /// </summary> /// <param name="inputString"></param> /// <returns></returns> public static GeoidalSeparation Parse(string inputString) { //---- declare vars GeoidalSeparation geoidal = new GeoidalSeparation(); //---- split it in half string[] halves = inputString.Trim().Split(','); //---- if (halves.Length < 2) { throw new FormatException("Input string must be in the format -3569.2,M"); } //---- parse the difference geoidal.Difference = decimal.Parse(halves[0]); //---- parse the units (should always be meters) geoidal.UnitType = UnitTypeUtil.Parse(halves[1]); //---- return(geoidal); }
//======================================================================= #region -= static methods =- /// <summary> /// Must be in the format 2398,M /// </summary> /// <param name="inputString"></param> /// <returns></returns> public static Elevation Parse(string inputString) { //---- declare vars Elevation elevation = new Elevation(); //---- split it in half string[] halves = inputString.Trim().Split(','); //---- if (halves.Length < 2) { throw new FormatException("Input string must be in the format 2398,M"); } //---- parse the value elevation.Value = decimal.Parse(halves[0]); //---- parse the units (should always be meters) elevation.UnitType = UnitTypeUtil.Parse(halves[1]); //---- return(elevation); }