Exemple #1
0
        /// <summary>
        ///     Try to dynamically construct a quantity.
        /// </summary>
        /// <param name="value">Numeric value.</param>
        /// <param name="unit">Unit enum value.</param>
        /// <param name="quantity">The resulting quantity if successful, otherwise <c>default</c>.</param>
        /// <returns><c>True</c> if successful with <paramref name="quantity"/> assigned the value, otherwise <c>false</c>.</returns>
        internal static bool TryFrom(decimal value, Enum unit, out IQuantity quantity)
        {
            switch (unit)
            {
            case AccelerationUnit accelerationUnit:
                quantity = Acceleration.From(value, accelerationUnit);
                return(true);

            case AmountOfSubstanceUnit amountOfSubstanceUnit:
                quantity = AmountOfSubstance.From(value, amountOfSubstanceUnit);
                return(true);

            case AmplitudeRatioUnit amplitudeRatioUnit:
                quantity = AmplitudeRatio.From(value, amplitudeRatioUnit);
                return(true);

            case AngleUnit angleUnit:
                quantity = Angle.From(value, angleUnit);
                return(true);

            case ApparentEnergyUnit apparentEnergyUnit:
                quantity = ApparentEnergy.From(value, apparentEnergyUnit);
                return(true);

            case ApparentPowerUnit apparentPowerUnit:
                quantity = ApparentPower.From(value, apparentPowerUnit);
                return(true);

            case AreaUnit areaUnit:
                quantity = Area.From(value, areaUnit);
                return(true);

            case AreaDensityUnit areaDensityUnit:
                quantity = AreaDensity.From(value, areaDensityUnit);
                return(true);

            case AreaMomentOfInertiaUnit areaMomentOfInertiaUnit:
                quantity = AreaMomentOfInertia.From(value, areaMomentOfInertiaUnit);
                return(true);

            case BitRateUnit bitRateUnit:
                quantity = BitRate.From(value, bitRateUnit);
                return(true);

            case BrakeSpecificFuelConsumptionUnit brakeSpecificFuelConsumptionUnit:
                quantity = BrakeSpecificFuelConsumption.From(value, brakeSpecificFuelConsumptionUnit);
                return(true);

            case CapacitanceUnit capacitanceUnit:
                quantity = Capacitance.From(value, capacitanceUnit);
                return(true);

            case CoefficientOfThermalExpansionUnit coefficientOfThermalExpansionUnit:
                quantity = CoefficientOfThermalExpansion.From(value, coefficientOfThermalExpansionUnit);
                return(true);

            case DensityUnit densityUnit:
                quantity = Density.From(value, densityUnit);
                return(true);

            case DurationUnit durationUnit:
                quantity = Duration.From(value, durationUnit);
                return(true);

            case DynamicViscosityUnit dynamicViscosityUnit:
                quantity = DynamicViscosity.From(value, dynamicViscosityUnit);
                return(true);

            case ElectricAdmittanceUnit electricAdmittanceUnit:
                quantity = ElectricAdmittance.From(value, electricAdmittanceUnit);
                return(true);

            case ElectricChargeUnit electricChargeUnit:
                quantity = ElectricCharge.From(value, electricChargeUnit);
                return(true);

            case ElectricChargeDensityUnit electricChargeDensityUnit:
                quantity = ElectricChargeDensity.From(value, electricChargeDensityUnit);
                return(true);

            case ElectricConductanceUnit electricConductanceUnit:
                quantity = ElectricConductance.From(value, electricConductanceUnit);
                return(true);

            case ElectricConductivityUnit electricConductivityUnit:
                quantity = ElectricConductivity.From(value, electricConductivityUnit);
                return(true);

            case ElectricCurrentUnit electricCurrentUnit:
                quantity = ElectricCurrent.From(value, electricCurrentUnit);
                return(true);

            case ElectricCurrentDensityUnit electricCurrentDensityUnit:
                quantity = ElectricCurrentDensity.From(value, electricCurrentDensityUnit);
                return(true);

            case ElectricCurrentGradientUnit electricCurrentGradientUnit:
                quantity = ElectricCurrentGradient.From(value, electricCurrentGradientUnit);
                return(true);

            case ElectricFieldUnit electricFieldUnit:
                quantity = ElectricField.From(value, electricFieldUnit);
                return(true);

            case ElectricInductanceUnit electricInductanceUnit:
                quantity = ElectricInductance.From(value, electricInductanceUnit);
                return(true);

            case ElectricPotentialUnit electricPotentialUnit:
                quantity = ElectricPotential.From(value, electricPotentialUnit);
                return(true);

            case ElectricPotentialAcUnit electricPotentialAcUnit:
                quantity = ElectricPotentialAc.From(value, electricPotentialAcUnit);
                return(true);

            case ElectricPotentialChangeRateUnit electricPotentialChangeRateUnit:
                quantity = ElectricPotentialChangeRate.From(value, electricPotentialChangeRateUnit);
                return(true);

            case ElectricPotentialDcUnit electricPotentialDcUnit:
                quantity = ElectricPotentialDc.From(value, electricPotentialDcUnit);
                return(true);

            case ElectricResistanceUnit electricResistanceUnit:
                quantity = ElectricResistance.From(value, electricResistanceUnit);
                return(true);

            case ElectricResistivityUnit electricResistivityUnit:
                quantity = ElectricResistivity.From(value, electricResistivityUnit);
                return(true);

            case ElectricSurfaceChargeDensityUnit electricSurfaceChargeDensityUnit:
                quantity = ElectricSurfaceChargeDensity.From(value, electricSurfaceChargeDensityUnit);
                return(true);

            case EnergyUnit energyUnit:
                quantity = Energy.From(value, energyUnit);
                return(true);

            case EntropyUnit entropyUnit:
                quantity = Entropy.From(value, entropyUnit);
                return(true);

            case ForceUnit forceUnit:
                quantity = Force.From(value, forceUnit);
                return(true);

            case ForceChangeRateUnit forceChangeRateUnit:
                quantity = ForceChangeRate.From(value, forceChangeRateUnit);
                return(true);

            case ForcePerLengthUnit forcePerLengthUnit:
                quantity = ForcePerLength.From(value, forcePerLengthUnit);
                return(true);

            case FrequencyUnit frequencyUnit:
                quantity = Frequency.From(value, frequencyUnit);
                return(true);

            case FuelEfficiencyUnit fuelEfficiencyUnit:
                quantity = FuelEfficiency.From(value, fuelEfficiencyUnit);
                return(true);

            case HeatFluxUnit heatFluxUnit:
                quantity = HeatFlux.From(value, heatFluxUnit);
                return(true);

            case HeatTransferCoefficientUnit heatTransferCoefficientUnit:
                quantity = HeatTransferCoefficient.From(value, heatTransferCoefficientUnit);
                return(true);

            case IlluminanceUnit illuminanceUnit:
                quantity = Illuminance.From(value, illuminanceUnit);
                return(true);

            case InformationUnit informationUnit:
                quantity = Information.From(value, informationUnit);
                return(true);

            case IrradianceUnit irradianceUnit:
                quantity = Irradiance.From(value, irradianceUnit);
                return(true);

            case IrradiationUnit irradiationUnit:
                quantity = Irradiation.From(value, irradiationUnit);
                return(true);

            case KinematicViscosityUnit kinematicViscosityUnit:
                quantity = KinematicViscosity.From(value, kinematicViscosityUnit);
                return(true);

            case LapseRateUnit lapseRateUnit:
                quantity = LapseRate.From(value, lapseRateUnit);
                return(true);

            case LengthUnit lengthUnit:
                quantity = Length.From(value, lengthUnit);
                return(true);

            case LevelUnit levelUnit:
                quantity = Level.From(value, levelUnit);
                return(true);

            case LinearDensityUnit linearDensityUnit:
                quantity = LinearDensity.From(value, linearDensityUnit);
                return(true);

            case LinearPowerDensityUnit linearPowerDensityUnit:
                quantity = LinearPowerDensity.From(value, linearPowerDensityUnit);
                return(true);

            case LuminosityUnit luminosityUnit:
                quantity = Luminosity.From(value, luminosityUnit);
                return(true);

            case LuminousFluxUnit luminousFluxUnit:
                quantity = LuminousFlux.From(value, luminousFluxUnit);
                return(true);

            case LuminousIntensityUnit luminousIntensityUnit:
                quantity = LuminousIntensity.From(value, luminousIntensityUnit);
                return(true);

            case MagneticFieldUnit magneticFieldUnit:
                quantity = MagneticField.From(value, magneticFieldUnit);
                return(true);

            case MagneticFluxUnit magneticFluxUnit:
                quantity = MagneticFlux.From(value, magneticFluxUnit);
                return(true);

            case MagnetizationUnit magnetizationUnit:
                quantity = Magnetization.From(value, magnetizationUnit);
                return(true);

            case MassUnit massUnit:
                quantity = Mass.From(value, massUnit);
                return(true);

            case MassConcentrationUnit massConcentrationUnit:
                quantity = MassConcentration.From(value, massConcentrationUnit);
                return(true);

            case MassFlowUnit massFlowUnit:
                quantity = MassFlow.From(value, massFlowUnit);
                return(true);

            case MassFluxUnit massFluxUnit:
                quantity = MassFlux.From(value, massFluxUnit);
                return(true);

            case MassFractionUnit massFractionUnit:
                quantity = MassFraction.From(value, massFractionUnit);
                return(true);

            case MassMomentOfInertiaUnit massMomentOfInertiaUnit:
                quantity = MassMomentOfInertia.From(value, massMomentOfInertiaUnit);
                return(true);

            case MolarEnergyUnit molarEnergyUnit:
                quantity = MolarEnergy.From(value, molarEnergyUnit);
                return(true);

            case MolarEntropyUnit molarEntropyUnit:
                quantity = MolarEntropy.From(value, molarEntropyUnit);
                return(true);

            case MolarityUnit molarityUnit:
                quantity = Molarity.From(value, molarityUnit);
                return(true);

            case MolarMassUnit molarMassUnit:
                quantity = MolarMass.From(value, molarMassUnit);
                return(true);

            case PermeabilityUnit permeabilityUnit:
                quantity = Permeability.From(value, permeabilityUnit);
                return(true);

            case PermittivityUnit permittivityUnit:
                quantity = Permittivity.From(value, permittivityUnit);
                return(true);

            case PowerUnit powerUnit:
                quantity = Power.From(value, powerUnit);
                return(true);

            case PowerDensityUnit powerDensityUnit:
                quantity = PowerDensity.From(value, powerDensityUnit);
                return(true);

            case PowerRatioUnit powerRatioUnit:
                quantity = PowerRatio.From(value, powerRatioUnit);
                return(true);

            case PressureUnit pressureUnit:
                quantity = Pressure.From(value, pressureUnit);
                return(true);

            case PressureChangeRateUnit pressureChangeRateUnit:
                quantity = PressureChangeRate.From(value, pressureChangeRateUnit);
                return(true);

            case RatioUnit ratioUnit:
                quantity = Ratio.From(value, ratioUnit);
                return(true);

            case RatioChangeRateUnit ratioChangeRateUnit:
                quantity = RatioChangeRate.From(value, ratioChangeRateUnit);
                return(true);

            case ReactiveEnergyUnit reactiveEnergyUnit:
                quantity = ReactiveEnergy.From(value, reactiveEnergyUnit);
                return(true);

            case ReactivePowerUnit reactivePowerUnit:
                quantity = ReactivePower.From(value, reactivePowerUnit);
                return(true);

            case RotationalAccelerationUnit rotationalAccelerationUnit:
                quantity = RotationalAcceleration.From(value, rotationalAccelerationUnit);
                return(true);

            case RotationalSpeedUnit rotationalSpeedUnit:
                quantity = RotationalSpeed.From(value, rotationalSpeedUnit);
                return(true);

            case RotationalStiffnessUnit rotationalStiffnessUnit:
                quantity = RotationalStiffness.From(value, rotationalStiffnessUnit);
                return(true);

            case RotationalStiffnessPerLengthUnit rotationalStiffnessPerLengthUnit:
                quantity = RotationalStiffnessPerLength.From(value, rotationalStiffnessPerLengthUnit);
                return(true);

            case SolidAngleUnit solidAngleUnit:
                quantity = SolidAngle.From(value, solidAngleUnit);
                return(true);

            case SpecificEnergyUnit specificEnergyUnit:
                quantity = SpecificEnergy.From(value, specificEnergyUnit);
                return(true);

            case SpecificEntropyUnit specificEntropyUnit:
                quantity = SpecificEntropy.From(value, specificEntropyUnit);
                return(true);

            case SpecificVolumeUnit specificVolumeUnit:
                quantity = SpecificVolume.From(value, specificVolumeUnit);
                return(true);

            case SpecificWeightUnit specificWeightUnit:
                quantity = SpecificWeight.From(value, specificWeightUnit);
                return(true);

            case SpeedUnit speedUnit:
                quantity = Speed.From(value, speedUnit);
                return(true);

            case TemperatureUnit temperatureUnit:
                quantity = Temperature.From(value, temperatureUnit);
                return(true);

            case TemperatureChangeRateUnit temperatureChangeRateUnit:
                quantity = TemperatureChangeRate.From(value, temperatureChangeRateUnit);
                return(true);

            case TemperatureDeltaUnit temperatureDeltaUnit:
                quantity = TemperatureDelta.From(value, temperatureDeltaUnit);
                return(true);

            case ThermalConductivityUnit thermalConductivityUnit:
                quantity = ThermalConductivity.From(value, thermalConductivityUnit);
                return(true);

            case ThermalResistanceUnit thermalResistanceUnit:
                quantity = ThermalResistance.From(value, thermalResistanceUnit);
                return(true);

            case TorqueUnit torqueUnit:
                quantity = Torque.From(value, torqueUnit);
                return(true);

            case TorquePerLengthUnit torquePerLengthUnit:
                quantity = TorquePerLength.From(value, torquePerLengthUnit);
                return(true);

            case TurbidityUnit turbidityUnit:
                quantity = Turbidity.From(value, turbidityUnit);
                return(true);

            case VitaminAUnit vitaminAUnit:
                quantity = VitaminA.From(value, vitaminAUnit);
                return(true);

            case VolumeUnit volumeUnit:
                quantity = Volume.From(value, volumeUnit);
                return(true);

            case VolumeConcentrationUnit volumeConcentrationUnit:
                quantity = VolumeConcentration.From(value, volumeConcentrationUnit);
                return(true);

            case VolumeFlowUnit volumeFlowUnit:
                quantity = VolumeFlow.From(value, volumeFlowUnit);
                return(true);

            case VolumePerLengthUnit volumePerLengthUnit:
                quantity = VolumePerLength.From(value, volumePerLengthUnit);
                return(true);

            case WarpingMomentOfInertiaUnit warpingMomentOfInertiaUnit:
                quantity = WarpingMomentOfInertia.From(value, warpingMomentOfInertiaUnit);
                return(true);

            default:
            {
                quantity = default(IQuantity);
                return(false);
            }
            }
        }
Exemple #2
0
        /// <summary>
        /// Dynamically constructs a quantity of the given <see cref="QuantityType"/> with the value in the quantity's base units.
        /// </summary>
        /// <param name="quantityType">The <see cref="QuantityType"/> of the quantity to create.</param>
        /// <param name="value">The value to construct the quantity with.</param>
        /// <returns>The created quantity.</returns>
        public static IQuantity FromQuantityType(QuantityType quantityType, QuantityValue value)
        {
            switch (quantityType)
            {
            case QuantityType.Acceleration:
                return(Acceleration.From(value, Acceleration.BaseUnit));

            case QuantityType.AmountOfSubstance:
                return(AmountOfSubstance.From(value, AmountOfSubstance.BaseUnit));

            case QuantityType.AmplitudeRatio:
                return(AmplitudeRatio.From(value, AmplitudeRatio.BaseUnit));

            case QuantityType.Angle:
                return(Angle.From(value, Angle.BaseUnit));

            case QuantityType.ApparentEnergy:
                return(ApparentEnergy.From(value, ApparentEnergy.BaseUnit));

            case QuantityType.ApparentPower:
                return(ApparentPower.From(value, ApparentPower.BaseUnit));

            case QuantityType.Area:
                return(Area.From(value, Area.BaseUnit));

            case QuantityType.AreaDensity:
                return(AreaDensity.From(value, AreaDensity.BaseUnit));

            case QuantityType.AreaMomentOfInertia:
                return(AreaMomentOfInertia.From(value, AreaMomentOfInertia.BaseUnit));

            case QuantityType.BitRate:
                return(BitRate.From(value, BitRate.BaseUnit));

            case QuantityType.BrakeSpecificFuelConsumption:
                return(BrakeSpecificFuelConsumption.From(value, BrakeSpecificFuelConsumption.BaseUnit));

            case QuantityType.Capacitance:
                return(Capacitance.From(value, Capacitance.BaseUnit));

            case QuantityType.CoefficientOfThermalExpansion:
                return(CoefficientOfThermalExpansion.From(value, CoefficientOfThermalExpansion.BaseUnit));

            case QuantityType.Density:
                return(Density.From(value, Density.BaseUnit));

            case QuantityType.Duration:
                return(Duration.From(value, Duration.BaseUnit));

            case QuantityType.DynamicViscosity:
                return(DynamicViscosity.From(value, DynamicViscosity.BaseUnit));

            case QuantityType.ElectricAdmittance:
                return(ElectricAdmittance.From(value, ElectricAdmittance.BaseUnit));

            case QuantityType.ElectricCharge:
                return(ElectricCharge.From(value, ElectricCharge.BaseUnit));

            case QuantityType.ElectricChargeDensity:
                return(ElectricChargeDensity.From(value, ElectricChargeDensity.BaseUnit));

            case QuantityType.ElectricConductance:
                return(ElectricConductance.From(value, ElectricConductance.BaseUnit));

            case QuantityType.ElectricConductivity:
                return(ElectricConductivity.From(value, ElectricConductivity.BaseUnit));

            case QuantityType.ElectricCurrent:
                return(ElectricCurrent.From(value, ElectricCurrent.BaseUnit));

            case QuantityType.ElectricCurrentDensity:
                return(ElectricCurrentDensity.From(value, ElectricCurrentDensity.BaseUnit));

            case QuantityType.ElectricCurrentGradient:
                return(ElectricCurrentGradient.From(value, ElectricCurrentGradient.BaseUnit));

            case QuantityType.ElectricField:
                return(ElectricField.From(value, ElectricField.BaseUnit));

            case QuantityType.ElectricInductance:
                return(ElectricInductance.From(value, ElectricInductance.BaseUnit));

            case QuantityType.ElectricPotential:
                return(ElectricPotential.From(value, ElectricPotential.BaseUnit));

            case QuantityType.ElectricPotentialAc:
                return(ElectricPotentialAc.From(value, ElectricPotentialAc.BaseUnit));

            case QuantityType.ElectricPotentialDc:
                return(ElectricPotentialDc.From(value, ElectricPotentialDc.BaseUnit));

            case QuantityType.ElectricResistance:
                return(ElectricResistance.From(value, ElectricResistance.BaseUnit));

            case QuantityType.ElectricResistivity:
                return(ElectricResistivity.From(value, ElectricResistivity.BaseUnit));

            case QuantityType.Energy:
                return(Energy.From(value, Energy.BaseUnit));

            case QuantityType.Entropy:
                return(Entropy.From(value, Entropy.BaseUnit));

            case QuantityType.Force:
                return(Force.From(value, Force.BaseUnit));

            case QuantityType.ForceChangeRate:
                return(ForceChangeRate.From(value, ForceChangeRate.BaseUnit));

            case QuantityType.ForcePerLength:
                return(ForcePerLength.From(value, ForcePerLength.BaseUnit));

            case QuantityType.Frequency:
                return(Frequency.From(value, Frequency.BaseUnit));

            case QuantityType.HeatFlux:
                return(HeatFlux.From(value, HeatFlux.BaseUnit));

            case QuantityType.HeatTransferCoefficient:
                return(HeatTransferCoefficient.From(value, HeatTransferCoefficient.BaseUnit));

            case QuantityType.Illuminance:
                return(Illuminance.From(value, Illuminance.BaseUnit));

            case QuantityType.Information:
                return(Information.From(value, Information.BaseUnit));

            case QuantityType.Irradiance:
                return(Irradiance.From(value, Irradiance.BaseUnit));

            case QuantityType.Irradiation:
                return(Irradiation.From(value, Irradiation.BaseUnit));

            case QuantityType.KinematicViscosity:
                return(KinematicViscosity.From(value, KinematicViscosity.BaseUnit));

            case QuantityType.LapseRate:
                return(LapseRate.From(value, LapseRate.BaseUnit));

            case QuantityType.Length:
                return(Length.From(value, Length.BaseUnit));

            case QuantityType.Level:
                return(Level.From(value, Level.BaseUnit));

            case QuantityType.LinearDensity:
                return(LinearDensity.From(value, LinearDensity.BaseUnit));

            case QuantityType.LuminousFlux:
                return(LuminousFlux.From(value, LuminousFlux.BaseUnit));

            case QuantityType.LuminousIntensity:
                return(LuminousIntensity.From(value, LuminousIntensity.BaseUnit));

            case QuantityType.MagneticField:
                return(MagneticField.From(value, MagneticField.BaseUnit));

            case QuantityType.MagneticFlux:
                return(MagneticFlux.From(value, MagneticFlux.BaseUnit));

            case QuantityType.Magnetization:
                return(Magnetization.From(value, Magnetization.BaseUnit));

            case QuantityType.Mass:
                return(Mass.From(value, Mass.BaseUnit));

            case QuantityType.MassFlow:
                return(MassFlow.From(value, MassFlow.BaseUnit));

            case QuantityType.MassFlux:
                return(MassFlux.From(value, MassFlux.BaseUnit));

            case QuantityType.MassMomentOfInertia:
                return(MassMomentOfInertia.From(value, MassMomentOfInertia.BaseUnit));

            case QuantityType.MolarEnergy:
                return(MolarEnergy.From(value, MolarEnergy.BaseUnit));

            case QuantityType.MolarEntropy:
                return(MolarEntropy.From(value, MolarEntropy.BaseUnit));

            case QuantityType.Molarity:
                return(Molarity.From(value, Molarity.BaseUnit));

            case QuantityType.MolarMass:
                return(MolarMass.From(value, MolarMass.BaseUnit));

            case QuantityType.Permeability:
                return(Permeability.From(value, Permeability.BaseUnit));

            case QuantityType.Permittivity:
                return(Permittivity.From(value, Permittivity.BaseUnit));

            case QuantityType.Power:
                return(Power.From(value, Power.BaseUnit));

            case QuantityType.PowerDensity:
                return(PowerDensity.From(value, PowerDensity.BaseUnit));

            case QuantityType.PowerRatio:
                return(PowerRatio.From(value, PowerRatio.BaseUnit));

            case QuantityType.Pressure:
                return(Pressure.From(value, Pressure.BaseUnit));

            case QuantityType.PressureChangeRate:
                return(PressureChangeRate.From(value, PressureChangeRate.BaseUnit));

            case QuantityType.Ratio:
                return(Ratio.From(value, Ratio.BaseUnit));

            case QuantityType.ReactiveEnergy:
                return(ReactiveEnergy.From(value, ReactiveEnergy.BaseUnit));

            case QuantityType.ReactivePower:
                return(ReactivePower.From(value, ReactivePower.BaseUnit));

            case QuantityType.RotationalAcceleration:
                return(RotationalAcceleration.From(value, RotationalAcceleration.BaseUnit));

            case QuantityType.RotationalSpeed:
                return(RotationalSpeed.From(value, RotationalSpeed.BaseUnit));

            case QuantityType.RotationalStiffness:
                return(RotationalStiffness.From(value, RotationalStiffness.BaseUnit));

            case QuantityType.RotationalStiffnessPerLength:
                return(RotationalStiffnessPerLength.From(value, RotationalStiffnessPerLength.BaseUnit));

            case QuantityType.SolidAngle:
                return(SolidAngle.From(value, SolidAngle.BaseUnit));

            case QuantityType.SpecificEnergy:
                return(SpecificEnergy.From(value, SpecificEnergy.BaseUnit));

            case QuantityType.SpecificEntropy:
                return(SpecificEntropy.From(value, SpecificEntropy.BaseUnit));

            case QuantityType.SpecificVolume:
                return(SpecificVolume.From(value, SpecificVolume.BaseUnit));

            case QuantityType.SpecificWeight:
                return(SpecificWeight.From(value, SpecificWeight.BaseUnit));

            case QuantityType.Speed:
                return(Speed.From(value, Speed.BaseUnit));

            case QuantityType.Temperature:
                return(Temperature.From(value, Temperature.BaseUnit));

            case QuantityType.TemperatureChangeRate:
                return(TemperatureChangeRate.From(value, TemperatureChangeRate.BaseUnit));

            case QuantityType.TemperatureDelta:
                return(TemperatureDelta.From(value, TemperatureDelta.BaseUnit));

            case QuantityType.ThermalConductivity:
                return(ThermalConductivity.From(value, ThermalConductivity.BaseUnit));

            case QuantityType.ThermalResistance:
                return(ThermalResistance.From(value, ThermalResistance.BaseUnit));

            case QuantityType.Torque:
                return(Torque.From(value, Torque.BaseUnit));

            case QuantityType.VitaminA:
                return(VitaminA.From(value, VitaminA.BaseUnit));

            case QuantityType.Volume:
                return(Volume.From(value, Volume.BaseUnit));

            case QuantityType.VolumeFlow:
                return(VolumeFlow.From(value, VolumeFlow.BaseUnit));

            case QuantityType.VolumePerLength:
                return(VolumePerLength.From(value, VolumePerLength.BaseUnit));

            default:
                throw new ArgumentException($"{quantityType} is not a supported quantity type.");
            }
        }