/// <summary>
        ///     Creates the quantity with the given numeric value and unit.
        /// </summary>
        /// <param name="value">The numeric value to construct this quantity with.</param>
        /// <param name="unit">The unit representation to construct this quantity with.</param>
        /// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
        /// <exception cref="ArgumentException">If value is NaN or Infinity.</exception>
        private SpecificWeight(double value, SpecificWeightUnit unit)
        {
            if (unit == SpecificWeightUnit.Undefined)
            {
                throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
            }

            _value = value;
            _unit  = unit;
        }
Exemple #2
0
        /// <summary>
        ///     Creates the quantity with the given numeric value and unit.
        /// </summary>
        /// <param name="numericValue">The numeric value  to contruct this quantity with.</param>
        /// <param name="unit">The unit representation to contruct this quantity with.</param>
        /// <exception cref="ArgumentException">If value is NaN or Infinity.</exception>
        public SpecificWeight(double numericValue, SpecificWeightUnit unit)
        {
            if (unit == SpecificWeightUnit.Undefined)
            {
                throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
            }

            _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue));
            _unit  = unit;
        }
 public SpecificWeight(double newtonspercubicmeter)
 {
     _value = Convert.ToDouble(newtonspercubicmeter);
     _unit  = BaseUnit;
 }
 SpecificWeight(double numericValue, SpecificWeightUnit unit)
 {
     _value = numericValue;
     _unit  = unit;
 }
 /// <summary>
 ///     Creates the quantity with a value of 0 in the base unit NewtonPerCubicMeter.
 /// </summary>
 /// <remarks>
 ///     Windows Runtime Component requires a default constructor.
 /// </remarks>
 public SpecificWeight()
 {
     _value = 0;
     _unit  = BaseUnit;
 }