public static ForceUnitType GetUnitAsEnum(string unitString) { IDictionaryEnumerator myEnumerator = unitStringTable.GetEnumerator(); String name; ForceUnitType type = ForceUnitType.Newton; while (myEnumerator.MoveNext()) { name = myEnumerator.Value as String; if (name.Equals(unitString)) { type = (ForceUnitType)myEnumerator.Key; break; } } return(type); }
public static double ConvertFromSIValue(ForceUnitType unitType, double newtonValue) { double convertionCoeff = (double)coeffTable[unitType]; return(newtonValue / convertionCoeff); }
public static string GetUnitAsString(ForceUnitType unitType) { return(unitStringTable[unitType] as String); }
public static double ConvertToSIValue(ForceUnitType unitType, double toBeConvertedValue) { double convertionCoeff = (double)coeffTable[unitType]; return(convertionCoeff * toBeConvertedValue); }