public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] IFormatProvider provider)
        {
            provider = provider ?? UnitSystem.DefaultCulture;

            return(UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit));
        }
 /// <summary>
 ///     Get string representation of value and unit. Using two significant digits after radix.
 /// </summary>
 /// <param name="unit">Unit representation to use.</param>
 /// <param name="provider">Format to use for localization and number formatting. Defaults to <see cref="UnitSystem.DefaultCulture" />.</param>
 /// <returns>String representation.</returns>
 public string ToString(MassFlowUnit unit, [CanBeNull] IFormatProvider provider)
 {
     return(ToString(unit, provider, 2));
 }
        /// <summary>
        ///     Converts this MassFlow to another MassFlow with the unit representation <paramref name="unit" />.
        /// </summary>
        /// <returns>A MassFlow with the specified unit.</returns>
        public MassFlow ToUnit(MassFlowUnit unit)
        {
            var convertedValue = AsBaseNumericType(unit);

            return(new MassFlow(convertedValue, unit));
        }
 public static MassFlow?From(QuantityValue?value, MassFlowUnit fromUnit)
 {
     return(value.HasValue ? new MassFlow((double)value.Value, fromUnit) : default(MassFlow?));
 }
 public static bool TryParseUnit(string str, out MassFlowUnit unit)
 {
     return(TryParseUnit(str, null, out unit));
 }
        /// <summary>
        ///     Parse a unit string.
        /// </summary>
        /// <param name="str">String to parse. Typically in the form: {number} {unit}</param>
        /// <param name="unit">The parsed unit if successful.</param>
        /// <returns>True if successful, otherwise false.</returns>
        /// <example>
        ///     Length.TryParseUnit("m", new CultureInfo("en-US"));
        /// </example>
        /// <param name="cultureName">Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
        public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassFlowUnit unit)
        {
            IFormatProvider provider = GetFormatProviderFromCultureName(cultureName);

            return(UnitParser.Default.TryParse <MassFlowUnit>(str, provider, out unit));
        }
        /// <summary>
        ///     Get unit abbreviation string.
        /// </summary>
        /// <param name="unit">Unit to get abbreviation for.</param>
        /// <returns>Unit abbreviation string.</returns>
        /// <param name="cultureName">Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
        public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] string cultureName)
        {
            IFormatProvider provider = GetFormatProviderFromCultureName(cultureName);

            return(UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider));
        }
 public static MassFlow From(double value, MassFlowUnit fromUnit)
 {
     return(new MassFlow((double)value, fromUnit));
 }
 protected static string CreateSuffix(SymbolFormat format, MassFlowUnit unit)
 {
     return default(MassFlow).ToString(unit, format).Trim('0');
 }
 /// <summary>
 ///     Get unit abbreviation string.
 /// </summary>
 /// <param name="unit">Unit to get abbreviation for.</param>
 /// <returns>Unit abbreviation string.</returns>
 public static string GetAbbreviation(MassFlowUnit unit)
 {
     return(GetAbbreviation(unit, null));
 }
Exemplo n.º 11
0
 /// <summary>
 ///     Get string representation of value and unit. Using two significant digits after radix.
 /// </summary>
 /// <param name="unit">Unit representation to use.</param>
 /// <param name="cultureName">Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to <see cref="UnitSystem" />'s default culture.</param>
 /// <returns>String representation.</returns>
 public string ToString(MassFlowUnit unit, [CanBeNull] string cultureName)
 {
     return(ToString(unit, cultureName, 2));
 }
Exemplo n.º 12
0
 public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] Culture culture)
 {
     return(UnitSystem.GetCached(culture).GetDefaultAbbreviation(unit));
 }
Exemplo n.º 13
0
 public static MassFlow From(double value, MassFlowUnit fromUnit)
Exemplo n.º 14
0
 /// <summary>
 ///     Get string representation of value and unit. Using two significant digits after radix.
 /// </summary>
 /// <param name="unit">Unit representation to use.</param>
 /// <param name="culture">Culture to use for localization and number formatting.</param>
 /// <returns>String representation.</returns>
 public string ToString(MassFlowUnit unit, [CanBeNull] Culture culture)
 {
     return(ToString(unit, culture, 2));
 }
Exemplo n.º 15
0
 /// <summary>
 ///     Get string representation of value and unit. Using current UI culture and two significant digits after radix.
 /// </summary>
 /// <param name="unit">Unit representation to use.</param>
 /// <returns>String representation.</returns>
 public string ToString(MassFlowUnit unit)
 {
     return(ToString(unit, null, 2));
 }