/// <summary>Get the human-readable name for a specified unit.</summary> /// <param name="unit">The unit to get the name for.</param> /// <param name="abbreviate">Whether or not to abbreviate the name.</param> /// <returns>The human-readable name for the specified unit.</returns> static public string UnitName(UnitSI unit, bool abbreviate) { string name; if (abbreviate) { if (unit == UnitSI.Byte) { name = "B"; } else { name = unit.ToString().Substring(0, 1) + "B"; } } else { name = unit.ToString(); } return(name); }
internal static double ConvertSI(double value, UnitSI fromUnit, UnitSI toUnit) { Debug.Assert(fromUnit != toUnit); return _Convert((int)fromUnit, (int)toUnit, FACTORS_SI, value); }
internal static double ConvertSI(double value, UnitSI fromUnit, UnitSI toUnit) { Debug.Assert(fromUnit != toUnit); return(_Convert((int)fromUnit, (int)toUnit, FACTORS_SI, value)); }
/// <summary>Get the human-readable name for a specified unit.</summary> /// <param name="unit">The unit to get the name for.</param> /// <returns>The human-readable name for the specified unit.</returns> /// <remarks>Defaults to the non-abbreviated name.</remarks> static public string UnitName(UnitSI unit) { return(UnitName(unit, false)); }