From ebd3275b84991f5d90113a03fb569cddd655c86e Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Wed, 9 Feb 2022 00:55:21 +0100 Subject: [PATCH] Fix consistent whitespace of if expressions --- .../NanoFrameworkGen/NuspecGenerator.cs | 2 +- .../NanoFrameworkGen/ProjectGenerator.cs | 2 +- .../NanoFrameworkGen/QuantityGenerator.cs | 12 ++--- .../UnitsNetGen/NumberExtensionsGenerator.cs | 2 +- .../NumberExtensionsTestClassGenerator.cs | 2 +- .../UnitsNetGen/QuantityGenerator.cs | 54 +++++++++---------- .../UnitsNetGen/UnitTestBaseClassGenerator.cs | 16 +++--- .../UnitsNetWrcGen/QuantityGenerator.cs | 18 +++---- .../Quantities/Acceleration.g.cs | 6 +-- .../Quantities/AmountOfSubstance.g.cs | 6 +-- .../Quantities/AmplitudeRatio.g.cs | 6 +-- .../GeneratedCode/Quantities/Angle.g.cs | 6 +-- .../Quantities/ApparentEnergy.g.cs | 6 +-- .../Quantities/ApparentPower.g.cs | 6 +-- .../GeneratedCode/Quantities/Area.g.cs | 6 +-- .../GeneratedCode/Quantities/AreaDensity.g.cs | 6 +-- .../Quantities/AreaMomentOfInertia.g.cs | 6 +-- .../GeneratedCode/Quantities/BitRate.g.cs | 6 +-- .../BrakeSpecificFuelConsumption.g.cs | 6 +-- .../GeneratedCode/Quantities/Capacitance.g.cs | 6 +-- .../CoefficientOfThermalExpansion.g.cs | 6 +-- .../GeneratedCode/Quantities/Density.g.cs | 6 +-- .../GeneratedCode/Quantities/Duration.g.cs | 6 +-- .../Quantities/DynamicViscosity.g.cs | 6 +-- .../Quantities/ElectricAdmittance.g.cs | 6 +-- .../Quantities/ElectricCharge.g.cs | 6 +-- .../Quantities/ElectricChargeDensity.g.cs | 6 +-- .../Quantities/ElectricConductance.g.cs | 6 +-- .../Quantities/ElectricConductivity.g.cs | 6 +-- .../Quantities/ElectricCurrent.g.cs | 6 +-- .../Quantities/ElectricCurrentDensity.g.cs | 6 +-- .../Quantities/ElectricCurrentGradient.g.cs | 6 +-- .../Quantities/ElectricField.g.cs | 6 +-- .../Quantities/ElectricInductance.g.cs | 6 +-- .../Quantities/ElectricPotential.g.cs | 6 +-- .../Quantities/ElectricPotentialAc.g.cs | 6 +-- .../ElectricPotentialChangeRate.g.cs | 6 +-- .../Quantities/ElectricPotentialDc.g.cs | 6 +-- .../Quantities/ElectricResistance.g.cs | 6 +-- .../Quantities/ElectricResistivity.g.cs | 6 +-- .../ElectricSurfaceChargeDensity.g.cs | 6 +-- .../GeneratedCode/Quantities/Energy.g.cs | 6 +-- .../GeneratedCode/Quantities/Entropy.g.cs | 6 +-- .../GeneratedCode/Quantities/Force.g.cs | 6 +-- .../Quantities/ForceChangeRate.g.cs | 6 +-- .../Quantities/ForcePerLength.g.cs | 6 +-- .../GeneratedCode/Quantities/Frequency.g.cs | 6 +-- .../Quantities/FuelEfficiency.g.cs | 6 +-- .../GeneratedCode/Quantities/HeatFlux.g.cs | 6 +-- .../Quantities/HeatTransferCoefficient.g.cs | 6 +-- .../GeneratedCode/Quantities/Illuminance.g.cs | 6 +-- .../GeneratedCode/Quantities/Information.g.cs | 6 +-- .../GeneratedCode/Quantities/Irradiance.g.cs | 6 +-- .../GeneratedCode/Quantities/Irradiation.g.cs | 6 +-- .../Quantities/KinematicViscosity.g.cs | 6 +-- .../GeneratedCode/Quantities/LapseRate.g.cs | 6 +-- .../GeneratedCode/Quantities/Length.g.cs | 6 +-- .../GeneratedCode/Quantities/Level.g.cs | 6 +-- .../Quantities/LinearDensity.g.cs | 6 +-- .../Quantities/LinearPowerDensity.g.cs | 6 +-- .../GeneratedCode/Quantities/Luminosity.g.cs | 6 +-- .../Quantities/LuminousFlux.g.cs | 6 +-- .../Quantities/LuminousIntensity.g.cs | 6 +-- .../Quantities/MagneticField.g.cs | 6 +-- .../Quantities/MagneticFlux.g.cs | 6 +-- .../Quantities/Magnetization.g.cs | 6 +-- .../GeneratedCode/Quantities/Mass.g.cs | 6 +-- .../Quantities/MassConcentration.g.cs | 6 +-- .../GeneratedCode/Quantities/MassFlow.g.cs | 6 +-- .../GeneratedCode/Quantities/MassFlux.g.cs | 6 +-- .../Quantities/MassFraction.g.cs | 6 +-- .../Quantities/MassMomentOfInertia.g.cs | 6 +-- .../GeneratedCode/Quantities/MolarEnergy.g.cs | 6 +-- .../Quantities/MolarEntropy.g.cs | 6 +-- .../GeneratedCode/Quantities/MolarMass.g.cs | 6 +-- .../GeneratedCode/Quantities/Molarity.g.cs | 6 +-- .../Quantities/Permeability.g.cs | 6 +-- .../Quantities/Permittivity.g.cs | 6 +-- .../GeneratedCode/Quantities/Power.g.cs | 6 +-- .../Quantities/PowerDensity.g.cs | 6 +-- .../GeneratedCode/Quantities/PowerRatio.g.cs | 6 +-- .../GeneratedCode/Quantities/Pressure.g.cs | 6 +-- .../Quantities/PressureChangeRate.g.cs | 6 +-- .../GeneratedCode/Quantities/Ratio.g.cs | 6 +-- .../Quantities/RatioChangeRate.g.cs | 6 +-- .../Quantities/ReactiveEnergy.g.cs | 6 +-- .../Quantities/ReactivePower.g.cs | 6 +-- .../Quantities/ReciprocalArea.g.cs | 6 +-- .../Quantities/ReciprocalLength.g.cs | 6 +-- .../Quantities/RelativeHumidity.g.cs | 6 +-- .../Quantities/RotationalAcceleration.g.cs | 6 +-- .../Quantities/RotationalSpeed.g.cs | 6 +-- .../Quantities/RotationalStiffness.g.cs | 6 +-- .../RotationalStiffnessPerLength.g.cs | 6 +-- .../GeneratedCode/Quantities/Scalar.g.cs | 6 +-- .../GeneratedCode/Quantities/SolidAngle.g.cs | 6 +-- .../Quantities/SpecificEnergy.g.cs | 6 +-- .../Quantities/SpecificEntropy.g.cs | 6 +-- .../Quantities/SpecificFuelConsumption.g.cs | 6 +-- .../Quantities/SpecificVolume.g.cs | 6 +-- .../Quantities/SpecificWeight.g.cs | 6 +-- .../GeneratedCode/Quantities/Speed.g.cs | 6 +-- .../Quantities/StandardVolumeFlow.g.cs | 6 +-- .../GeneratedCode/Quantities/Temperature.g.cs | 6 +-- .../Quantities/TemperatureChangeRate.g.cs | 6 +-- .../Quantities/TemperatureDelta.g.cs | 6 +-- .../Quantities/TemperatureGradient.g.cs | 6 +-- .../Quantities/ThermalConductivity.g.cs | 6 +-- .../Quantities/ThermalResistance.g.cs | 6 +-- .../GeneratedCode/Quantities/Torque.g.cs | 6 +-- .../Quantities/TorquePerLength.g.cs | 6 +-- .../GeneratedCode/Quantities/Turbidity.g.cs | 6 +-- .../GeneratedCode/Quantities/VitaminA.g.cs | 6 +-- .../GeneratedCode/Quantities/Volume.g.cs | 6 +-- .../Quantities/VolumeConcentration.g.cs | 6 +-- .../GeneratedCode/Quantities/VolumeFlow.g.cs | 6 +-- .../Quantities/VolumeFlowPerArea.g.cs | 6 +-- .../Quantities/VolumePerLength.g.cs | 6 +-- .../Quantities/VolumetricHeatCapacity.g.cs | 6 +-- .../Quantities/WarpingMomentOfInertia.g.cs | 6 +-- UnitsNet.Tests/AssertEx.cs | 4 +- .../TestsBase/AccelerationTestsBase.g.cs | 4 +- .../TestsBase/AmountOfSubstanceTestsBase.g.cs | 4 +- .../TestsBase/AmplitudeRatioTestsBase.g.cs | 4 +- .../TestsBase/AngleTestsBase.g.cs | 4 +- .../TestsBase/ApparentEnergyTestsBase.g.cs | 4 +- .../TestsBase/ApparentPowerTestsBase.g.cs | 4 +- .../TestsBase/AreaDensityTestsBase.g.cs | 4 +- .../AreaMomentOfInertiaTestsBase.g.cs | 4 +- .../TestsBase/AreaTestsBase.g.cs | 4 +- .../TestsBase/BitRateTestsBase.g.cs | 4 +- ...BrakeSpecificFuelConsumptionTestsBase.g.cs | 4 +- .../TestsBase/CapacitanceTestsBase.g.cs | 4 +- ...oefficientOfThermalExpansionTestsBase.g.cs | 4 +- .../TestsBase/DensityTestsBase.g.cs | 4 +- .../TestsBase/DurationTestsBase.g.cs | 4 +- .../TestsBase/DynamicViscosityTestsBase.g.cs | 4 +- .../ElectricAdmittanceTestsBase.g.cs | 4 +- .../ElectricChargeDensityTestsBase.g.cs | 4 +- .../TestsBase/ElectricChargeTestsBase.g.cs | 4 +- .../ElectricConductanceTestsBase.g.cs | 4 +- .../ElectricConductivityTestsBase.g.cs | 4 +- .../ElectricCurrentDensityTestsBase.g.cs | 4 +- .../ElectricCurrentGradientTestsBase.g.cs | 4 +- .../TestsBase/ElectricCurrentTestsBase.g.cs | 4 +- .../TestsBase/ElectricFieldTestsBase.g.cs | 4 +- .../ElectricInductanceTestsBase.g.cs | 4 +- .../ElectricPotentialAcTestsBase.g.cs | 4 +- .../ElectricPotentialChangeRateTestsBase.g.cs | 4 +- .../ElectricPotentialDcTestsBase.g.cs | 4 +- .../TestsBase/ElectricPotentialTestsBase.g.cs | 4 +- .../ElectricResistanceTestsBase.g.cs | 4 +- .../ElectricResistivityTestsBase.g.cs | 4 +- ...ElectricSurfaceChargeDensityTestsBase.g.cs | 4 +- .../TestsBase/EnergyTestsBase.g.cs | 4 +- .../TestsBase/EntropyTestsBase.g.cs | 4 +- .../TestsBase/ForceChangeRateTestsBase.g.cs | 4 +- .../TestsBase/ForcePerLengthTestsBase.g.cs | 4 +- .../TestsBase/ForceTestsBase.g.cs | 4 +- .../TestsBase/FrequencyTestsBase.g.cs | 4 +- .../TestsBase/FuelEfficiencyTestsBase.g.cs | 4 +- .../TestsBase/HeatFluxTestsBase.g.cs | 4 +- .../HeatTransferCoefficientTestsBase.g.cs | 4 +- .../TestsBase/IlluminanceTestsBase.g.cs | 4 +- .../TestsBase/InformationTestsBase.g.cs | 4 +- .../TestsBase/IrradianceTestsBase.g.cs | 4 +- .../TestsBase/IrradiationTestsBase.g.cs | 4 +- .../KinematicViscosityTestsBase.g.cs | 4 +- .../TestsBase/LapseRateTestsBase.g.cs | 4 +- .../TestsBase/LengthTestsBase.g.cs | 4 +- .../TestsBase/LevelTestsBase.g.cs | 4 +- .../TestsBase/LinearDensityTestsBase.g.cs | 4 +- .../LinearPowerDensityTestsBase.g.cs | 4 +- .../TestsBase/LuminosityTestsBase.g.cs | 4 +- .../TestsBase/LuminousFluxTestsBase.g.cs | 4 +- .../TestsBase/LuminousIntensityTestsBase.g.cs | 4 +- .../TestsBase/MagneticFieldTestsBase.g.cs | 4 +- .../TestsBase/MagneticFluxTestsBase.g.cs | 4 +- .../TestsBase/MagnetizationTestsBase.g.cs | 4 +- .../TestsBase/MassConcentrationTestsBase.g.cs | 4 +- .../TestsBase/MassFlowTestsBase.g.cs | 4 +- .../TestsBase/MassFluxTestsBase.g.cs | 4 +- .../TestsBase/MassFractionTestsBase.g.cs | 4 +- .../MassMomentOfInertiaTestsBase.g.cs | 4 +- .../TestsBase/MassTestsBase.g.cs | 4 +- .../TestsBase/MolarEnergyTestsBase.g.cs | 4 +- .../TestsBase/MolarEntropyTestsBase.g.cs | 4 +- .../TestsBase/MolarMassTestsBase.g.cs | 4 +- .../TestsBase/MolarityTestsBase.g.cs | 4 +- .../TestsBase/PermeabilityTestsBase.g.cs | 4 +- .../TestsBase/PermittivityTestsBase.g.cs | 4 +- .../TestsBase/PowerDensityTestsBase.g.cs | 4 +- .../TestsBase/PowerRatioTestsBase.g.cs | 4 +- .../TestsBase/PowerTestsBase.g.cs | 4 +- .../PressureChangeRateTestsBase.g.cs | 4 +- .../TestsBase/PressureTestsBase.g.cs | 4 +- .../TestsBase/RatioChangeRateTestsBase.g.cs | 4 +- .../TestsBase/RatioTestsBase.g.cs | 4 +- .../TestsBase/ReactiveEnergyTestsBase.g.cs | 4 +- .../TestsBase/ReactivePowerTestsBase.g.cs | 4 +- .../TestsBase/ReciprocalAreaTestsBase.g.cs | 4 +- .../TestsBase/ReciprocalLengthTestsBase.g.cs | 4 +- .../TestsBase/RelativeHumidityTestsBase.g.cs | 4 +- .../RotationalAccelerationTestsBase.g.cs | 4 +- .../TestsBase/RotationalSpeedTestsBase.g.cs | 4 +- ...RotationalStiffnessPerLengthTestsBase.g.cs | 4 +- .../RotationalStiffnessTestsBase.g.cs | 4 +- .../TestsBase/ScalarTestsBase.g.cs | 4 +- .../TestsBase/SolidAngleTestsBase.g.cs | 4 +- .../TestsBase/SpecificEnergyTestsBase.g.cs | 4 +- .../TestsBase/SpecificEntropyTestsBase.g.cs | 4 +- .../SpecificFuelConsumptionTestsBase.g.cs | 4 +- .../TestsBase/SpecificVolumeTestsBase.g.cs | 4 +- .../TestsBase/SpecificWeightTestsBase.g.cs | 4 +- .../TestsBase/SpeedTestsBase.g.cs | 4 +- .../StandardVolumeFlowTestsBase.g.cs | 4 +- .../TemperatureChangeRateTestsBase.g.cs | 4 +- .../TestsBase/TemperatureDeltaTestsBase.g.cs | 4 +- .../TemperatureGradientTestsBase.g.cs | 4 +- .../TestsBase/TemperatureTestsBase.g.cs | 4 +- .../ThermalConductivityTestsBase.g.cs | 4 +- .../TestsBase/ThermalResistanceTestsBase.g.cs | 4 +- .../TestsBase/TorquePerLengthTestsBase.g.cs | 4 +- .../TestsBase/TorqueTestsBase.g.cs | 4 +- .../TestsBase/TurbidityTestsBase.g.cs | 4 +- .../TestsBase/VitaminATestsBase.g.cs | 4 +- .../VolumeConcentrationTestsBase.g.cs | 4 +- .../TestsBase/VolumeFlowPerAreaTestsBase.g.cs | 4 +- .../TestsBase/VolumeFlowTestsBase.g.cs | 4 +- .../TestsBase/VolumePerLengthTestsBase.g.cs | 4 +- .../TestsBase/VolumeTestsBase.g.cs | 4 +- .../VolumetricHeatCapacityTestsBase.g.cs | 4 +- .../WarpingMomentOfInertiaTestsBase.g.cs | 4 +- .../Quantities/Acceleration.g.cs | 14 ++--- .../Quantities/AmountOfSubstance.g.cs | 14 ++--- .../Quantities/AmplitudeRatio.g.cs | 14 ++--- .../GeneratedCode/Quantities/Angle.g.cs | 14 ++--- .../Quantities/ApparentEnergy.g.cs | 14 ++--- .../Quantities/ApparentPower.g.cs | 14 ++--- .../GeneratedCode/Quantities/Area.g.cs | 14 ++--- .../GeneratedCode/Quantities/AreaDensity.g.cs | 14 ++--- .../Quantities/AreaMomentOfInertia.g.cs | 14 ++--- .../GeneratedCode/Quantities/BitRate.g.cs | 14 ++--- .../BrakeSpecificFuelConsumption.g.cs | 14 ++--- .../GeneratedCode/Quantities/Capacitance.g.cs | 14 ++--- .../CoefficientOfThermalExpansion.g.cs | 14 ++--- .../GeneratedCode/Quantities/Density.g.cs | 14 ++--- .../GeneratedCode/Quantities/Duration.g.cs | 14 ++--- .../Quantities/DynamicViscosity.g.cs | 14 ++--- .../Quantities/ElectricAdmittance.g.cs | 14 ++--- .../Quantities/ElectricCharge.g.cs | 14 ++--- .../Quantities/ElectricChargeDensity.g.cs | 14 ++--- .../Quantities/ElectricConductance.g.cs | 14 ++--- .../Quantities/ElectricConductivity.g.cs | 14 ++--- .../Quantities/ElectricCurrent.g.cs | 14 ++--- .../Quantities/ElectricCurrentDensity.g.cs | 14 ++--- .../Quantities/ElectricCurrentGradient.g.cs | 14 ++--- .../Quantities/ElectricField.g.cs | 14 ++--- .../Quantities/ElectricInductance.g.cs | 14 ++--- .../Quantities/ElectricPotential.g.cs | 14 ++--- .../Quantities/ElectricPotentialAc.g.cs | 14 ++--- .../ElectricPotentialChangeRate.g.cs | 14 ++--- .../Quantities/ElectricPotentialDc.g.cs | 14 ++--- .../Quantities/ElectricResistance.g.cs | 14 ++--- .../Quantities/ElectricResistivity.g.cs | 14 ++--- .../ElectricSurfaceChargeDensity.g.cs | 14 ++--- .../GeneratedCode/Quantities/Energy.g.cs | 14 ++--- .../GeneratedCode/Quantities/Entropy.g.cs | 14 ++--- .../GeneratedCode/Quantities/Force.g.cs | 14 ++--- .../Quantities/ForceChangeRate.g.cs | 14 ++--- .../Quantities/ForcePerLength.g.cs | 14 ++--- .../GeneratedCode/Quantities/Frequency.g.cs | 14 ++--- .../Quantities/FuelEfficiency.g.cs | 14 ++--- .../GeneratedCode/Quantities/HeatFlux.g.cs | 14 ++--- .../Quantities/HeatTransferCoefficient.g.cs | 14 ++--- .../GeneratedCode/Quantities/Illuminance.g.cs | 14 ++--- .../GeneratedCode/Quantities/Information.g.cs | 14 ++--- .../GeneratedCode/Quantities/Irradiance.g.cs | 14 ++--- .../GeneratedCode/Quantities/Irradiation.g.cs | 14 ++--- .../Quantities/KinematicViscosity.g.cs | 14 ++--- .../GeneratedCode/Quantities/LapseRate.g.cs | 14 ++--- .../GeneratedCode/Quantities/Length.g.cs | 14 ++--- .../GeneratedCode/Quantities/Level.g.cs | 14 ++--- .../Quantities/LinearDensity.g.cs | 14 ++--- .../Quantities/LinearPowerDensity.g.cs | 14 ++--- .../GeneratedCode/Quantities/Luminosity.g.cs | 14 ++--- .../Quantities/LuminousFlux.g.cs | 14 ++--- .../Quantities/LuminousIntensity.g.cs | 14 ++--- .../Quantities/MagneticField.g.cs | 14 ++--- .../Quantities/MagneticFlux.g.cs | 14 ++--- .../Quantities/Magnetization.g.cs | 14 ++--- .../GeneratedCode/Quantities/Mass.g.cs | 14 ++--- .../Quantities/MassConcentration.g.cs | 14 ++--- .../GeneratedCode/Quantities/MassFlow.g.cs | 14 ++--- .../GeneratedCode/Quantities/MassFlux.g.cs | 14 ++--- .../Quantities/MassFraction.g.cs | 14 ++--- .../Quantities/MassMomentOfInertia.g.cs | 14 ++--- .../GeneratedCode/Quantities/MolarEnergy.g.cs | 14 ++--- .../Quantities/MolarEntropy.g.cs | 14 ++--- .../GeneratedCode/Quantities/MolarMass.g.cs | 14 ++--- .../GeneratedCode/Quantities/Molarity.g.cs | 14 ++--- .../Quantities/Permeability.g.cs | 14 ++--- .../Quantities/Permittivity.g.cs | 14 ++--- .../GeneratedCode/Quantities/Power.g.cs | 14 ++--- .../Quantities/PowerDensity.g.cs | 14 ++--- .../GeneratedCode/Quantities/PowerRatio.g.cs | 14 ++--- .../GeneratedCode/Quantities/Pressure.g.cs | 14 ++--- .../Quantities/PressureChangeRate.g.cs | 14 ++--- .../GeneratedCode/Quantities/Ratio.g.cs | 14 ++--- .../Quantities/RatioChangeRate.g.cs | 14 ++--- .../Quantities/ReactiveEnergy.g.cs | 14 ++--- .../Quantities/ReactivePower.g.cs | 14 ++--- .../Quantities/ReciprocalArea.g.cs | 14 ++--- .../Quantities/ReciprocalLength.g.cs | 14 ++--- .../Quantities/RelativeHumidity.g.cs | 14 ++--- .../Quantities/RotationalAcceleration.g.cs | 14 ++--- .../Quantities/RotationalSpeed.g.cs | 14 ++--- .../Quantities/RotationalStiffness.g.cs | 14 ++--- .../RotationalStiffnessPerLength.g.cs | 14 ++--- .../GeneratedCode/Quantities/Scalar.g.cs | 14 ++--- .../GeneratedCode/Quantities/SolidAngle.g.cs | 14 ++--- .../Quantities/SpecificEnergy.g.cs | 14 ++--- .../Quantities/SpecificEntropy.g.cs | 14 ++--- .../Quantities/SpecificFuelConsumption.g.cs | 14 ++--- .../Quantities/SpecificVolume.g.cs | 14 ++--- .../Quantities/SpecificWeight.g.cs | 14 ++--- .../GeneratedCode/Quantities/Speed.g.cs | 14 ++--- .../Quantities/StandardVolumeFlow.g.cs | 14 ++--- .../GeneratedCode/Quantities/Temperature.g.cs | 14 ++--- .../Quantities/TemperatureChangeRate.g.cs | 14 ++--- .../Quantities/TemperatureDelta.g.cs | 14 ++--- .../Quantities/TemperatureGradient.g.cs | 14 ++--- .../Quantities/ThermalConductivity.g.cs | 14 ++--- .../Quantities/ThermalResistance.g.cs | 14 ++--- .../GeneratedCode/Quantities/Torque.g.cs | 14 ++--- .../Quantities/TorquePerLength.g.cs | 14 ++--- .../GeneratedCode/Quantities/Turbidity.g.cs | 14 ++--- .../GeneratedCode/Quantities/VitaminA.g.cs | 14 ++--- .../GeneratedCode/Quantities/Volume.g.cs | 14 ++--- .../Quantities/VolumeConcentration.g.cs | 14 ++--- .../GeneratedCode/Quantities/VolumeFlow.g.cs | 14 ++--- .../Quantities/VolumeFlowPerArea.g.cs | 14 ++--- .../Quantities/VolumePerLength.g.cs | 14 ++--- .../Quantities/VolumetricHeatCapacity.g.cs | 14 ++--- .../Quantities/WarpingMomentOfInertia.g.cs | 14 ++--- UnitsNet/BaseDimensions.cs | 18 +++---- UnitsNet/BaseUnits.cs | 8 +-- .../CustomCode/Quantities/Duration.extra.cs | 2 +- .../Quantities/ElectricConductivity.extra.cs | 2 +- .../Quantities/ElectricResistivity.extra.cs | 2 +- .../CustomCode/Quantities/Length.extra.cs | 2 +- UnitsNet/CustomCode/QuantityParser.cs | 4 +- UnitsNet/CustomCode/UnitAbbreviationsCache.cs | 26 ++++----- UnitsNet/CustomCode/UnitParser.cs | 8 +-- .../CustomCode/UnitValueAbbreviationLookup.cs | 12 ++--- .../Quantities/Acceleration.g.cs | 45 ++++++++-------- .../Quantities/AmountOfSubstance.g.cs | 45 ++++++++-------- .../Quantities/AmplitudeRatio.g.cs | 45 ++++++++-------- UnitsNet/GeneratedCode/Quantities/Angle.g.cs | 45 ++++++++-------- .../Quantities/ApparentEnergy.g.cs | 45 ++++++++-------- .../Quantities/ApparentPower.g.cs | 45 ++++++++-------- UnitsNet/GeneratedCode/Quantities/Area.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/AreaDensity.g.cs | 45 ++++++++-------- .../Quantities/AreaMomentOfInertia.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/BitRate.g.cs | 45 ++++++++-------- .../BrakeSpecificFuelConsumption.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/Capacitance.g.cs | 45 ++++++++-------- .../CoefficientOfThermalExpansion.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/Density.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/Duration.g.cs | 45 ++++++++-------- .../Quantities/DynamicViscosity.g.cs | 45 ++++++++-------- .../Quantities/ElectricAdmittance.g.cs | 45 ++++++++-------- .../Quantities/ElectricCharge.g.cs | 45 ++++++++-------- .../Quantities/ElectricChargeDensity.g.cs | 45 ++++++++-------- .../Quantities/ElectricConductance.g.cs | 45 ++++++++-------- .../Quantities/ElectricConductivity.g.cs | 45 ++++++++-------- .../Quantities/ElectricCurrent.g.cs | 45 ++++++++-------- .../Quantities/ElectricCurrentDensity.g.cs | 45 ++++++++-------- .../Quantities/ElectricCurrentGradient.g.cs | 45 ++++++++-------- .../Quantities/ElectricField.g.cs | 45 ++++++++-------- .../Quantities/ElectricInductance.g.cs | 45 ++++++++-------- .../Quantities/ElectricPotential.g.cs | 45 ++++++++-------- .../Quantities/ElectricPotentialAc.g.cs | 45 ++++++++-------- .../ElectricPotentialChangeRate.g.cs | 45 ++++++++-------- .../Quantities/ElectricPotentialDc.g.cs | 45 ++++++++-------- .../Quantities/ElectricResistance.g.cs | 45 ++++++++-------- .../Quantities/ElectricResistivity.g.cs | 45 ++++++++-------- .../ElectricSurfaceChargeDensity.g.cs | 45 ++++++++-------- UnitsNet/GeneratedCode/Quantities/Energy.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/Entropy.g.cs | 45 ++++++++-------- UnitsNet/GeneratedCode/Quantities/Force.g.cs | 45 ++++++++-------- .../Quantities/ForceChangeRate.g.cs | 45 ++++++++-------- .../Quantities/ForcePerLength.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/Frequency.g.cs | 45 ++++++++-------- .../Quantities/FuelEfficiency.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/HeatFlux.g.cs | 45 ++++++++-------- .../Quantities/HeatTransferCoefficient.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/Illuminance.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/Information.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/Irradiance.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/Irradiation.g.cs | 45 ++++++++-------- .../Quantities/KinematicViscosity.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/LapseRate.g.cs | 45 ++++++++-------- UnitsNet/GeneratedCode/Quantities/Length.g.cs | 45 ++++++++-------- UnitsNet/GeneratedCode/Quantities/Level.g.cs | 45 ++++++++-------- .../Quantities/LinearDensity.g.cs | 45 ++++++++-------- .../Quantities/LinearPowerDensity.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/Luminosity.g.cs | 45 ++++++++-------- .../Quantities/LuminousFlux.g.cs | 45 ++++++++-------- .../Quantities/LuminousIntensity.g.cs | 45 ++++++++-------- .../Quantities/MagneticField.g.cs | 45 ++++++++-------- .../Quantities/MagneticFlux.g.cs | 45 ++++++++-------- .../Quantities/Magnetization.g.cs | 45 ++++++++-------- UnitsNet/GeneratedCode/Quantities/Mass.g.cs | 45 ++++++++-------- .../Quantities/MassConcentration.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/MassFlow.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/MassFlux.g.cs | 45 ++++++++-------- .../Quantities/MassFraction.g.cs | 45 ++++++++-------- .../Quantities/MassMomentOfInertia.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/MolarEnergy.g.cs | 45 ++++++++-------- .../Quantities/MolarEntropy.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/MolarMass.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/Molarity.g.cs | 45 ++++++++-------- .../Quantities/Permeability.g.cs | 45 ++++++++-------- .../Quantities/Permittivity.g.cs | 45 ++++++++-------- UnitsNet/GeneratedCode/Quantities/Power.g.cs | 45 ++++++++-------- .../Quantities/PowerDensity.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/PowerRatio.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/Pressure.g.cs | 45 ++++++++-------- .../Quantities/PressureChangeRate.g.cs | 45 ++++++++-------- UnitsNet/GeneratedCode/Quantities/Ratio.g.cs | 45 ++++++++-------- .../Quantities/RatioChangeRate.g.cs | 45 ++++++++-------- .../Quantities/ReactiveEnergy.g.cs | 45 ++++++++-------- .../Quantities/ReactivePower.g.cs | 45 ++++++++-------- .../Quantities/ReciprocalArea.g.cs | 45 ++++++++-------- .../Quantities/ReciprocalLength.g.cs | 45 ++++++++-------- .../Quantities/RelativeHumidity.g.cs | 45 ++++++++-------- .../Quantities/RotationalAcceleration.g.cs | 45 ++++++++-------- .../Quantities/RotationalSpeed.g.cs | 45 ++++++++-------- .../Quantities/RotationalStiffness.g.cs | 45 ++++++++-------- .../RotationalStiffnessPerLength.g.cs | 45 ++++++++-------- UnitsNet/GeneratedCode/Quantities/Scalar.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/SolidAngle.g.cs | 45 ++++++++-------- .../Quantities/SpecificEnergy.g.cs | 45 ++++++++-------- .../Quantities/SpecificEntropy.g.cs | 45 ++++++++-------- .../Quantities/SpecificFuelConsumption.g.cs | 45 ++++++++-------- .../Quantities/SpecificVolume.g.cs | 45 ++++++++-------- .../Quantities/SpecificWeight.g.cs | 45 ++++++++-------- UnitsNet/GeneratedCode/Quantities/Speed.g.cs | 45 ++++++++-------- .../Quantities/StandardVolumeFlow.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/Temperature.g.cs | 45 ++++++++-------- .../Quantities/TemperatureChangeRate.g.cs | 45 ++++++++-------- .../Quantities/TemperatureDelta.g.cs | 45 ++++++++-------- .../Quantities/TemperatureGradient.g.cs | 45 ++++++++-------- .../Quantities/ThermalConductivity.g.cs | 45 ++++++++-------- .../Quantities/ThermalResistance.g.cs | 45 ++++++++-------- UnitsNet/GeneratedCode/Quantities/Torque.g.cs | 45 ++++++++-------- .../Quantities/TorquePerLength.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/Turbidity.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/VitaminA.g.cs | 45 ++++++++-------- UnitsNet/GeneratedCode/Quantities/Volume.g.cs | 45 ++++++++-------- .../Quantities/VolumeConcentration.g.cs | 45 ++++++++-------- .../GeneratedCode/Quantities/VolumeFlow.g.cs | 45 ++++++++-------- .../Quantities/VolumeFlowPerArea.g.cs | 45 ++++++++-------- .../Quantities/VolumePerLength.g.cs | 45 ++++++++-------- .../Quantities/VolumetricHeatCapacity.g.cs | 45 ++++++++-------- .../Quantities/WarpingMomentOfInertia.g.cs | 45 ++++++++-------- UnitsNet/QuantityFormatter.cs | 8 +-- UnitsNet/QuantityInfo.cs | 6 +-- UnitsNet/QuantityTypeConverter.cs | 4 +- UnitsNet/UnitConverter.cs | 2 +- 471 files changed, 3803 insertions(+), 4141 deletions(-) diff --git a/CodeGen/Generators/NanoFrameworkGen/NuspecGenerator.cs b/CodeGen/Generators/NanoFrameworkGen/NuspecGenerator.cs index f0acdb707e..466d931cf3 100644 --- a/CodeGen/Generators/NanoFrameworkGen/NuspecGenerator.cs +++ b/CodeGen/Generators/NanoFrameworkGen/NuspecGenerator.cs @@ -42,7 +42,7 @@ public override string Generate() "); - if(NanoFrameworkGenerator.ProjectsRequiringMath.Contains(_quantity.Name)) + if (NanoFrameworkGenerator.ProjectsRequiringMath.Contains(_quantity.Name)) { Writer.WL($@" "); diff --git a/CodeGen/Generators/NanoFrameworkGen/ProjectGenerator.cs b/CodeGen/Generators/NanoFrameworkGen/ProjectGenerator.cs index a6ac6851b6..aebb7127f3 100644 --- a/CodeGen/Generators/NanoFrameworkGen/ProjectGenerator.cs +++ b/CodeGen/Generators/NanoFrameworkGen/ProjectGenerator.cs @@ -48,7 +48,7 @@ public override string Generate() True "); - if(NanoFrameworkGenerator.ProjectsRequiringMath.Contains(_quantity.Name)) + if (NanoFrameworkGenerator.ProjectsRequiringMath.Contains(_quantity.Name)) { Writer.WL($@" diff --git a/CodeGen/Generators/NanoFrameworkGen/QuantityGenerator.cs b/CodeGen/Generators/NanoFrameworkGen/QuantityGenerator.cs index f3a1f09a19..2b682af0bf 100644 --- a/CodeGen/Generators/NanoFrameworkGen/QuantityGenerator.cs +++ b/CodeGen/Generators/NanoFrameworkGen/QuantityGenerator.cs @@ -14,7 +14,7 @@ internal class QuantityGenerator : GeneratorBase public QuantityGenerator(Quantity quantity) { _quantity = quantity ?? throw new ArgumentNullException(nameof(quantity)); - _unitEnumName = $"{quantity.Name}Unit"; + _unitEnumName = $"{quantity.Name}Unit"; } public override string Generate() @@ -124,7 +124,7 @@ private void GenerateConversionProperties() "); foreach (var unit in _quantity.Units) { - if(unit.SkipConversionGeneration) + if (unit.SkipConversionGeneration) continue; Writer.WL($@" @@ -149,7 +149,7 @@ private void GenerateStaticFactoryMethods() "); foreach (var unit in _quantity.Units) { - if(unit.SkipConversionGeneration) + if (unit.SkipConversionGeneration) continue; var valueParamName = unit.PluralName.ToLowerInvariant(); @@ -189,7 +189,7 @@ private void GenerateConversionMethods() /// Convert to the unit representation . /// /// Value converted to the specified unit. - public {_quantity.BaseType} As({_unitEnumName} unit) => GetValueAs(unit); + public {_quantity.BaseType} As({_unitEnumName} unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -197,12 +197,10 @@ private void GenerateConversionMethods() /// A Duration with the specified unit. public {_quantity.Name} ToUnit({_unitEnumName} unit) {{ - var convertedValue = GetValueAs(unit); return new {_quantity.Name}(convertedValue, unit); }} - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -227,7 +225,7 @@ private void GenerateConversionMethods() private {_quantity.BaseType} GetValueAs({_unitEnumName} unit) {{ - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/CodeGen/Generators/UnitsNetGen/NumberExtensionsGenerator.cs b/CodeGen/Generators/UnitsNetGen/NumberExtensionsGenerator.cs index afc8b6fcf7..2f60d23605 100644 --- a/CodeGen/Generators/UnitsNetGen/NumberExtensionsGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/NumberExtensionsGenerator.cs @@ -37,7 +37,7 @@ public static class NumberTo{_quantityName}Extensions foreach (var unit in _units) { - if(unit.SkipConversionGeneration) + if (unit.SkipConversionGeneration) continue; Writer.WL(2, $@" diff --git a/CodeGen/Generators/UnitsNetGen/NumberExtensionsTestClassGenerator.cs b/CodeGen/Generators/UnitsNetGen/NumberExtensionsTestClassGenerator.cs index ccdde82879..2b8f81b107 100644 --- a/CodeGen/Generators/UnitsNetGen/NumberExtensionsTestClassGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/NumberExtensionsTestClassGenerator.cs @@ -33,7 +33,7 @@ public class NumberTo{_quantityName}ExtensionsTests foreach (var unit in _units) { - if(unit.SkipConversionGeneration) + if (unit.SkipConversionGeneration) continue; Writer.WL(2, $@" diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs index 6b195a238c..a5e96aeeb9 100644 --- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs @@ -183,7 +183,7 @@ private void GenerateInstanceConstructors() /// If value is NaN or Infinity. public {_quantity.Name}({_quantity.BaseType} value, {_unitEnumName} unit) {{ - if(unit == {_unitEnumName}.Undefined) + if (unit == {_unitEnumName}.Undefined) throw new ArgumentException(""The quantity can not be created with an undefined unit."", nameof(unit)); "); @@ -206,7 +206,7 @@ private void GenerateInstanceConstructors() /// No unit was found for the given . public {_quantity.Name}({_valueType} value, UnitSystem unitSystem) {{ - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -334,7 +334,7 @@ private void GenerateConversionProperties() "); foreach (var unit in _quantity.Units) { - if(unit.SkipConversionGeneration) + if (unit.SkipConversionGeneration) continue; Writer.WL($@" @@ -369,7 +369,7 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) foreach(var unit in _quantity.Units) { - if(unit.SingularName == _quantity.BaseUnit) + if (unit.SingularName == _quantity.BaseUnit) continue; var func = unit.FromBaseToUnitFunc.Replace("{x}", "quantity.Value"); @@ -378,7 +378,7 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) } Writer.WL($@" - + // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction<{_quantity.Name}>({_unitEnumName}.{_quantity.BaseUnit}, {_unitEnumName}.{_quantity.BaseUnit}, quantity => quantity); @@ -386,7 +386,7 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) foreach(var unit in _quantity.Units) { - if(unit.SingularName == _quantity.BaseUnit) + if (unit.SingularName == _quantity.BaseUnit) continue; var func = unit.FromUnitToBaseFunc.Replace("{x}", "quantity.Value"); @@ -448,7 +448,7 @@ private void GenerateStaticFactoryMethods() "); foreach (var unit in _quantity.Units) { - if(unit.SkipConversionGeneration) + if (unit.SkipConversionGeneration) continue; var valueParamName = unit.PluralName.ToLowerInvariant(); @@ -801,8 +801,8 @@ private void GenerateEqualityAndComparison() /// public int CompareTo(object obj) {{ - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is {_quantity.Name} obj{_quantity.Name})) throw new ArgumentException(""Expected type {_quantity.Name}."", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is {_quantity.Name} obj{_quantity.Name})) throw new ArgumentException(""Expected type {_quantity.Name}."", nameof(obj)); return CompareTo(obj{_quantity.Name}); }} @@ -817,7 +817,7 @@ public int CompareTo({_quantity.Name} other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) {{ - if(obj is null || !(obj is {_quantity.Name} obj{_quantity.Name})) + if (obj is null || !(obj is {_quantity.Name} obj{_quantity.Name})) return false; return Equals(obj{_quantity.Name}); @@ -872,7 +872,7 @@ public bool Equals({_quantity.Name} other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals({_quantity.Name} other, double tolerance, ComparisonType comparisonType) {{ - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException(""tolerance"", ""Tolerance must be greater than or equal to 0.""); double thisValue = (double)this.Value; @@ -905,7 +905,7 @@ private void GenerateConversionMethods() /// Value converted to the specified unit. public double As({_unitEnumName} unit) {{ - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -915,13 +915,13 @@ public double As({_unitEnumName} unit) /// public double As(UnitSystem unitSystem) {{ - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException(""No units were found for the given UnitSystem."", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -930,7 +930,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) {{ - if(!(unit is {_unitEnumName} unitAs{_unitEnumName})) + if (!(unit is {_unitEnumName} unitAs{_unitEnumName})) throw new ArgumentException($""The given unit is of type {{unit.GetType()}}. Only {{typeof({_unitEnumName})}} is supported."", nameof(unit)); return As(unitAs{_unitEnumName}); @@ -954,18 +954,18 @@ double IQuantity.As(Enum unit) /// A {_quantity.Name} with the specified unit. public {_quantity.Name} ToUnit({_unitEnumName} unit, UnitConverter unitConverter) {{ - if(Unit == unit) + if (Unit == unit) {{ // Already in requested units. return this; }} - else if(unitConverter.TryGetConversionFunction((typeof({_quantity.Name}), Unit, typeof({_quantity.Name}), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof({_quantity.Name}), Unit, typeof({_quantity.Name}), unit), out var conversionFunction)) {{ // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return ({_quantity.Name})converted; }} - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) {{ // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -980,7 +980,7 @@ double IQuantity.As(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit) {{ - if(!(unit is {_unitEnumName} unitAs{_unitEnumName})) + if (!(unit is {_unitEnumName} unitAs{_unitEnumName})) throw new ArgumentException($""The given unit is of type {{unit.GetType()}}. Only {{typeof({_unitEnumName})}} is supported."", nameof(unit)); return ToUnit(unitAs{_unitEnumName}, DefaultConversionFunctions); @@ -989,7 +989,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) {{ - if(!(unit is {_unitEnumName} unitAs{_unitEnumName})) + if (!(unit is {_unitEnumName} unitAs{_unitEnumName})) throw new ArgumentException($""The given unit is of type {{unit.GetType()}}. Only {{typeof({_unitEnumName})}} is supported."", nameof(unit)); return ToUnit(unitAs{_unitEnumName}, unitConverter); @@ -998,13 +998,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public {_quantity.Name} ToUnit(UnitSystem unitSystem) {{ - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException(""No units were found for the given UnitSystem."", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1189,15 +1189,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) {{ - if(conversionType == typeof({_quantity.Name})) + if (conversionType == typeof({_quantity.Name})) return this; - else if(conversionType == typeof({_unitEnumName})) + else if (conversionType == typeof({_unitEnumName})) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return {_quantity.Name}.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return {_quantity.Name}.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return {_quantity.Name}.BaseDimensions; else throw new InvalidCastException($""Converting {{typeof({_quantity.Name})}} to {{conversionType}} is not supported.""); diff --git a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs index d0c3b80e10..38512f0d3d 100644 --- a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs @@ -98,7 +98,7 @@ public abstract partial class {_quantity.Name}TestsBase : QuantityTestsBase {{"); foreach (var unit in _quantity.Units) { - if(unit.SkipConversionGeneration) + if (unit.SkipConversionGeneration) continue; Writer.WL($@" @@ -110,7 +110,7 @@ public abstract partial class {_quantity.Name}TestsBase : QuantityTestsBase // ReSharper disable VirtualMemberNeverOverriden.Global"); foreach (var unit in _quantity.Units) { - if(unit.SkipConversionGeneration) + if (unit.SkipConversionGeneration) continue; Writer.WL($@" @@ -151,14 +151,14 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() {{ var quantity = new {_quantity.Name}(); Assert.Equal(0, quantity.Value);"); - if(_quantity.BaseType == "decimal") Writer.WL($@" + if (_quantity.BaseType == "decimal") Writer.WL($@" Assert.Equal(0m, ((IDecimalQuantity)quantity).Value);"); Writer.WL($@" Assert.Equal({_baseUnitFullName}, quantity.Unit); }} "); - if(_quantity.BaseType == "double") Writer.WL($@" + if (_quantity.BaseType == "double") Writer.WL($@" [Fact] public void Ctor_WithInfinityValue_ThrowsArgumentException() {{ @@ -240,7 +240,7 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() Writer.WL($@" }} "); - if(_quantity.BaseType == "double") Writer.WL($@" + if (_quantity.BaseType == "double") Writer.WL($@" [Fact] public void From{_baseUnit.PluralName}_WithInfinityValue_ThrowsArgumentException() {{ @@ -310,7 +310,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit({_unitEnumName} var fromUnit = {_quantity.Name}.Units.FirstOrDefault(u => u != {_quantity.Name}.BaseUnit && u != {_unitEnumName}.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == {_unitEnumName}.Undefined) + if (fromUnit == {_unitEnumName}.Undefined) fromUnit = {_quantity.Name}.BaseUnit; var quantity = {_quantity.Name}.From(3.0, fromUnit); @@ -496,7 +496,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof({_unitEnumName})).Cast<{_unitEnumName}>(); foreach(var unit in units) {{ - if(unit == {_unitEnumName}.Undefined) + if (unit == {_unitEnumName}.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); @@ -748,7 +748,7 @@ public void GetHashCode_Equals() }} "); - if(_quantity.GenerateArithmetic) + if (_quantity.GenerateArithmetic) { Writer.WL($@" [Theory] diff --git a/CodeGen/Generators/UnitsNetWrcGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetWrcGen/QuantityGenerator.cs index 39f73d21f1..1e26b0f365 100644 --- a/CodeGen/Generators/UnitsNetWrcGen/QuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetWrcGen/QuantityGenerator.cs @@ -150,7 +150,7 @@ private void GenerateInstanceConstructors() /// If value is NaN or Infinity. private {_quantity.Name}({_quantity.BaseType} value, {_unitEnumName} unit) {{ - if(unit == {_unitEnumName}.Undefined) + if (unit == {_unitEnumName}.Undefined) throw new ArgumentException(""The quantity can not be created with an undefined unit."", nameof(unit)); "); @@ -259,7 +259,7 @@ private void GenerateConversionProperties() "); foreach (var unit in _quantity.Units) { - if(unit.SkipConversionGeneration) + if (unit.SkipConversionGeneration) continue; Writer.WL($@" @@ -336,7 +336,7 @@ private void GenerateStaticFactoryMethods() "); foreach (var unit in _quantity.Units) { - if(unit.SkipConversionGeneration) + if (unit.SkipConversionGeneration) continue; var valueParamName = unit.PluralName.ToLowerInvariant(); @@ -533,8 +533,8 @@ private void GenerateEqualityAndComparison() public int CompareTo(object obj) {{ - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is {_quantity.Name} obj{_quantity.Name})) throw new ArgumentException(""Expected type {_quantity.Name}."", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is {_quantity.Name} obj{_quantity.Name})) throw new ArgumentException(""Expected type {_quantity.Name}."", nameof(obj)); return CompareTo(obj{_quantity.Name}); }} @@ -548,7 +548,7 @@ internal int CompareTo({_quantity.Name} other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) {{ - if(obj is null || !(obj is {_quantity.Name} obj{_quantity.Name})) + if (obj is null || !(obj is {_quantity.Name} obj{_quantity.Name})) return false; return Equals(obj{_quantity.Name}); @@ -601,7 +601,7 @@ public bool Equals({_quantity.Name} other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals({_quantity.Name} other, double tolerance, ComparisonType comparisonType) {{ - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException(""tolerance"", ""Tolerance must be greater than or equal to 0.""); double thisValue = (double)this.Value; @@ -636,7 +636,7 @@ private void GenerateConversionMethods() /// Value converted to the specified unit. public double As({_unitEnumName} unit) {{ - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -677,7 +677,7 @@ public double As({_unitEnumName} unit) private {_valueType} AsBaseNumericType({_unitEnumName} unit) {{ - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Acceleration.g.cs index dc6440eb7e..874c2ec9c9 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Acceleration.g.cs @@ -255,7 +255,7 @@ public static Acceleration From(double value, AccelerationUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(AccelerationUnit unit) => GetValueAs(unit); + public double As(AccelerationUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -263,12 +263,10 @@ public static Acceleration From(double value, AccelerationUnit fromUnit) /// A Duration with the specified unit. public Acceleration ToUnit(AccelerationUnit unit) { - var convertedValue = GetValueAs(unit); return new Acceleration(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -299,7 +297,7 @@ private double GetValueInBaseUnit() private double GetValueAs(AccelerationUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/AmountOfSubstance.g.cs index 9eb6832d19..4fd741b4d0 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -266,7 +266,7 @@ public static AmountOfSubstance From(double value, AmountOfSubstanceUnit fromUni /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(AmountOfSubstanceUnit unit) => GetValueAs(unit); + public double As(AmountOfSubstanceUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -274,12 +274,10 @@ public static AmountOfSubstance From(double value, AmountOfSubstanceUnit fromUni /// A Duration with the specified unit. public AmountOfSubstance ToUnit(AmountOfSubstanceUnit unit) { - var convertedValue = GetValueAs(unit); return new AmountOfSubstance(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -311,7 +309,7 @@ private double GetValueInBaseUnit() private double GetValueAs(AmountOfSubstanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/AmplitudeRatio.g.cs index 50998b84fd..970033f09d 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/AmplitudeRatio.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/AmplitudeRatio.g.cs @@ -145,7 +145,7 @@ public static AmplitudeRatio From(double value, AmplitudeRatioUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(AmplitudeRatioUnit unit) => GetValueAs(unit); + public double As(AmplitudeRatioUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -153,12 +153,10 @@ public static AmplitudeRatio From(double value, AmplitudeRatioUnit fromUnit) /// A Duration with the specified unit. public AmplitudeRatio ToUnit(AmplitudeRatioUnit unit) { - var convertedValue = GetValueAs(unit); return new AmplitudeRatio(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -179,7 +177,7 @@ private double GetValueInBaseUnit() private double GetValueAs(AmplitudeRatioUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Angle.g.cs index 75262d8ee1..768f49c779 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Angle.g.cs @@ -277,7 +277,7 @@ public static Angle From(double value, AngleUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(AngleUnit unit) => GetValueAs(unit); + public double As(AngleUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -285,12 +285,10 @@ public static Angle From(double value, AngleUnit fromUnit) /// A Duration with the specified unit. public Angle ToUnit(AngleUnit unit) { - var convertedValue = GetValueAs(unit); return new Angle(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -323,7 +321,7 @@ private double GetValueInBaseUnit() private double GetValueAs(AngleUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ApparentEnergy.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ApparentEnergy.g.cs index 612c22331c..a1e0734491 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ApparentEnergy.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ApparentEnergy.g.cs @@ -134,7 +134,7 @@ public static ApparentEnergy From(double value, ApparentEnergyUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ApparentEnergyUnit unit) => GetValueAs(unit); + public double As(ApparentEnergyUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -142,12 +142,10 @@ public static ApparentEnergy From(double value, ApparentEnergyUnit fromUnit) /// A Duration with the specified unit. public ApparentEnergy ToUnit(ApparentEnergyUnit unit) { - var convertedValue = GetValueAs(unit); return new ApparentEnergy(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -167,7 +165,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ApparentEnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ApparentPower.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ApparentPower.g.cs index a29629b7f0..0c989a55ed 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ApparentPower.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ApparentPower.g.cs @@ -145,7 +145,7 @@ public static ApparentPower From(double value, ApparentPowerUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ApparentPowerUnit unit) => GetValueAs(unit); + public double As(ApparentPowerUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -153,12 +153,10 @@ public static ApparentPower From(double value, ApparentPowerUnit fromUnit) /// A Duration with the specified unit. public ApparentPower ToUnit(ApparentPowerUnit unit) { - var convertedValue = GetValueAs(unit); return new ApparentPower(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -179,7 +177,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ApparentPowerUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Area.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Area.g.cs index 17ed64b773..6ac3766aac 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Area.g.cs @@ -255,7 +255,7 @@ public static Area From(double value, AreaUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(AreaUnit unit) => GetValueAs(unit); + public double As(AreaUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -263,12 +263,10 @@ public static Area From(double value, AreaUnit fromUnit) /// A Duration with the specified unit. public Area ToUnit(AreaUnit unit) { - var convertedValue = GetValueAs(unit); return new Area(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -299,7 +297,7 @@ private double GetValueInBaseUnit() private double GetValueAs(AreaUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/AreaDensity.g.cs index e3e80a9084..023d1ba7c0 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/AreaDensity.g.cs @@ -112,7 +112,7 @@ public static AreaDensity From(double value, AreaDensityUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(AreaDensityUnit unit) => GetValueAs(unit); + public double As(AreaDensityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -120,12 +120,10 @@ public static AreaDensity From(double value, AreaDensityUnit fromUnit) /// A Duration with the specified unit. public AreaDensity ToUnit(AreaDensityUnit unit) { - var convertedValue = GetValueAs(unit); return new AreaDensity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -143,7 +141,7 @@ private double GetValueInBaseUnit() private double GetValueAs(AreaDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs index c273455fd4..cd5e97f2df 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -167,7 +167,7 @@ public static AreaMomentOfInertia From(double value, AreaMomentOfInertiaUnit fro /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(AreaMomentOfInertiaUnit unit) => GetValueAs(unit); + public double As(AreaMomentOfInertiaUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -175,12 +175,10 @@ public static AreaMomentOfInertia From(double value, AreaMomentOfInertiaUnit fro /// A Duration with the specified unit. public AreaMomentOfInertia ToUnit(AreaMomentOfInertiaUnit unit) { - var convertedValue = GetValueAs(unit); return new AreaMomentOfInertia(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -203,7 +201,7 @@ private double GetValueInBaseUnit() private double GetValueAs(AreaMomentOfInertiaUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/BitRate.g.cs index ff2fc354d4..124bbe5ffb 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/BitRate.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/BitRate.g.cs @@ -390,7 +390,7 @@ public static BitRate From(double value, BitRateUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(BitRateUnit unit) => GetValueAs(unit); + public double As(BitRateUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -398,12 +398,10 @@ public static BitRate From(double value, BitRateUnit fromUnit) /// A Duration with the specified unit. public BitRate ToUnit(BitRateUnit unit) { - var convertedValue = GetValueAs(unit); return new BitRate(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -446,7 +444,7 @@ private double GetValueInBaseUnit() private double GetValueAs(BitRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs index 60ba7a14f4..470f9eeddf 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -134,7 +134,7 @@ public static BrakeSpecificFuelConsumption From(double value, BrakeSpecificFuelC /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(BrakeSpecificFuelConsumptionUnit unit) => GetValueAs(unit); + public double As(BrakeSpecificFuelConsumptionUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -142,12 +142,10 @@ public static BrakeSpecificFuelConsumption From(double value, BrakeSpecificFuelC /// A Duration with the specified unit. public BrakeSpecificFuelConsumption ToUnit(BrakeSpecificFuelConsumptionUnit unit) { - var convertedValue = GetValueAs(unit); return new BrakeSpecificFuelConsumption(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -167,7 +165,7 @@ private double GetValueInBaseUnit() private double GetValueAs(BrakeSpecificFuelConsumptionUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Capacitance.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Capacitance.g.cs index 8403d8e2bc..0910e6f0c5 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Capacitance.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Capacitance.g.cs @@ -181,7 +181,7 @@ public static Capacitance From(double value, CapacitanceUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(CapacitanceUnit unit) => GetValueAs(unit); + public double As(CapacitanceUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -189,12 +189,10 @@ public static Capacitance From(double value, CapacitanceUnit fromUnit) /// A Duration with the specified unit. public Capacitance ToUnit(CapacitanceUnit unit) { - var convertedValue = GetValueAs(unit); return new Capacitance(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -218,7 +216,7 @@ private double GetValueInBaseUnit() private double GetValueAs(CapacitanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs index 629809f3b9..936fa953a8 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs @@ -134,7 +134,7 @@ public static CoefficientOfThermalExpansion From(double value, CoefficientOfTher /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(CoefficientOfThermalExpansionUnit unit) => GetValueAs(unit); + public double As(CoefficientOfThermalExpansionUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -142,12 +142,10 @@ public static CoefficientOfThermalExpansion From(double value, CoefficientOfTher /// A Duration with the specified unit. public CoefficientOfThermalExpansion ToUnit(CoefficientOfThermalExpansionUnit unit) { - var convertedValue = GetValueAs(unit); return new CoefficientOfThermalExpansion(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -167,7 +165,7 @@ private double GetValueInBaseUnit() private double GetValueAs(CoefficientOfThermalExpansionUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Density.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Density.g.cs index 203b4e88f8..db87cb6ce9 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Density.g.cs @@ -665,7 +665,7 @@ public static Density From(double value, DensityUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(DensityUnit unit) => GetValueAs(unit); + public double As(DensityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -673,12 +673,10 @@ public static Density From(double value, DensityUnit fromUnit) /// A Duration with the specified unit. public Density ToUnit(DensityUnit unit) { - var convertedValue = GetValueAs(unit); return new Density(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -746,7 +744,7 @@ private double GetValueInBaseUnit() private double GetValueAs(DensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Duration.g.cs index 80bf80352a..6faa2205b6 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Duration.g.cs @@ -222,7 +222,7 @@ public static Duration From(double value, DurationUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(DurationUnit unit) => GetValueAs(unit); + public double As(DurationUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -230,12 +230,10 @@ public static Duration From(double value, DurationUnit fromUnit) /// A Duration with the specified unit. public Duration ToUnit(DurationUnit unit) { - var convertedValue = GetValueAs(unit); return new Duration(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -263,7 +261,7 @@ private double GetValueInBaseUnit() private double GetValueAs(DurationUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/DynamicViscosity.g.cs index a4576107fe..042151ce40 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -214,7 +214,7 @@ public static DynamicViscosity From(double value, DynamicViscosityUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(DynamicViscosityUnit unit) => GetValueAs(unit); + public double As(DynamicViscosityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -222,12 +222,10 @@ public static DynamicViscosity From(double value, DynamicViscosityUnit fromUnit) /// A Duration with the specified unit. public DynamicViscosity ToUnit(DynamicViscosityUnit unit) { - var convertedValue = GetValueAs(unit); return new DynamicViscosity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -254,7 +252,7 @@ private double GetValueInBaseUnit() private double GetValueAs(DynamicViscosityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricAdmittance.g.cs index 8756c91def..c750e3cec8 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricAdmittance.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricAdmittance.g.cs @@ -145,7 +145,7 @@ public static ElectricAdmittance From(double value, ElectricAdmittanceUnit fromU /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricAdmittanceUnit unit) => GetValueAs(unit); + public double As(ElectricAdmittanceUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -153,12 +153,10 @@ public static ElectricAdmittance From(double value, ElectricAdmittanceUnit fromU /// A Duration with the specified unit. public ElectricAdmittance ToUnit(ElectricAdmittanceUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricAdmittance(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -179,7 +177,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricAdmittanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricCharge.g.cs index 6358fe31dc..4186a6609c 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -159,7 +159,7 @@ public static ElectricCharge From(double value, ElectricChargeUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricChargeUnit unit) => GetValueAs(unit); + public double As(ElectricChargeUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -167,12 +167,10 @@ public static ElectricCharge From(double value, ElectricChargeUnit fromUnit) /// A Duration with the specified unit. public ElectricCharge ToUnit(ElectricChargeUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricCharge(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -194,7 +192,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricChargeUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricChargeDensity.g.cs index 7e5e070a36..af00e069b6 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricChargeDensity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricChargeDensity.g.cs @@ -115,7 +115,7 @@ public static ElectricChargeDensity From(double value, ElectricChargeDensityUnit /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricChargeDensityUnit unit) => GetValueAs(unit); + public double As(ElectricChargeDensityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -123,12 +123,10 @@ public static ElectricChargeDensity From(double value, ElectricChargeDensityUnit /// A Duration with the specified unit. public ElectricChargeDensity ToUnit(ElectricChargeDensityUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricChargeDensity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -146,7 +144,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricChargeDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricConductance.g.cs index e71d7a8db0..5db3b49c45 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricConductance.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricConductance.g.cs @@ -137,7 +137,7 @@ public static ElectricConductance From(double value, ElectricConductanceUnit fro /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricConductanceUnit unit) => GetValueAs(unit); + public double As(ElectricConductanceUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -145,12 +145,10 @@ public static ElectricConductance From(double value, ElectricConductanceUnit fro /// A Duration with the specified unit. public ElectricConductance ToUnit(ElectricConductanceUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricConductance(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -170,7 +168,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricConductanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricConductivity.g.cs index 857ae824f7..cf4a999e48 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -137,7 +137,7 @@ public static ElectricConductivity From(double value, ElectricConductivityUnit f /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricConductivityUnit unit) => GetValueAs(unit); + public double As(ElectricConductivityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -145,12 +145,10 @@ public static ElectricConductivity From(double value, ElectricConductivityUnit f /// A Duration with the specified unit. public ElectricConductivity ToUnit(ElectricConductivityUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricConductivity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -170,7 +168,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricConductivityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricCurrent.g.cs index 5e2aded212..77c9b67ef4 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -189,7 +189,7 @@ public static ElectricCurrent From(double value, ElectricCurrentUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricCurrentUnit unit) => GetValueAs(unit); + public double As(ElectricCurrentUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -197,12 +197,10 @@ public static ElectricCurrent From(double value, ElectricCurrentUnit fromUnit) /// A Duration with the specified unit. public ElectricCurrent ToUnit(ElectricCurrentUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricCurrent(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -227,7 +225,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricCurrentUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs index fb70b7a8c5..cb8f017dd3 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs @@ -137,7 +137,7 @@ public static ElectricCurrentDensity From(double value, ElectricCurrentDensityUn /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricCurrentDensityUnit unit) => GetValueAs(unit); + public double As(ElectricCurrentDensityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -145,12 +145,10 @@ public static ElectricCurrentDensity From(double value, ElectricCurrentDensityUn /// A Duration with the specified unit. public ElectricCurrentDensity ToUnit(ElectricCurrentDensityUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricCurrentDensity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -170,7 +168,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricCurrentDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs index 476e0de0aa..c0911be472 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -145,7 +145,7 @@ public static ElectricCurrentGradient From(double value, ElectricCurrentGradient /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricCurrentGradientUnit unit) => GetValueAs(unit); + public double As(ElectricCurrentGradientUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -153,12 +153,10 @@ public static ElectricCurrentGradient From(double value, ElectricCurrentGradient /// A Duration with the specified unit. public ElectricCurrentGradient ToUnit(ElectricCurrentGradientUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricCurrentGradient(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -179,7 +177,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricCurrentGradientUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricField.g.cs index 542856d0d9..9e9f454c45 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricField.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricField.g.cs @@ -115,7 +115,7 @@ public static ElectricField From(double value, ElectricFieldUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricFieldUnit unit) => GetValueAs(unit); + public double As(ElectricFieldUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -123,12 +123,10 @@ public static ElectricField From(double value, ElectricFieldUnit fromUnit) /// A Duration with the specified unit. public ElectricField ToUnit(ElectricFieldUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricField(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -146,7 +144,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricFieldUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricInductance.g.cs index c2c6b8a0f5..6d92c3dc49 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricInductance.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricInductance.g.cs @@ -148,7 +148,7 @@ public static ElectricInductance From(double value, ElectricInductanceUnit fromU /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricInductanceUnit unit) => GetValueAs(unit); + public double As(ElectricInductanceUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -156,12 +156,10 @@ public static ElectricInductance From(double value, ElectricInductanceUnit fromU /// A Duration with the specified unit. public ElectricInductance ToUnit(ElectricInductanceUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricInductance(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -182,7 +180,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricInductanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotential.g.cs index d3a1896e86..4382d4e83f 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -156,7 +156,7 @@ public static ElectricPotential From(double value, ElectricPotentialUnit fromUni /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricPotentialUnit unit) => GetValueAs(unit); + public double As(ElectricPotentialUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -164,12 +164,10 @@ public static ElectricPotential From(double value, ElectricPotentialUnit fromUni /// A Duration with the specified unit. public ElectricPotential ToUnit(ElectricPotentialUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricPotential(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -191,7 +189,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricPotentialUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotentialAc.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotentialAc.g.cs index a3bc3f2ad4..79af150776 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotentialAc.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotentialAc.g.cs @@ -156,7 +156,7 @@ public static ElectricPotentialAc From(double value, ElectricPotentialAcUnit fro /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricPotentialAcUnit unit) => GetValueAs(unit); + public double As(ElectricPotentialAcUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -164,12 +164,10 @@ public static ElectricPotentialAc From(double value, ElectricPotentialAcUnit fro /// A Duration with the specified unit. public ElectricPotentialAc ToUnit(ElectricPotentialAcUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricPotentialAc(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -191,7 +189,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricPotentialAcUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs index 3da8868632..64851e98b2 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs @@ -321,7 +321,7 @@ public static ElectricPotentialChangeRate From(double value, ElectricPotentialCh /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricPotentialChangeRateUnit unit) => GetValueAs(unit); + public double As(ElectricPotentialChangeRateUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -329,12 +329,10 @@ public static ElectricPotentialChangeRate From(double value, ElectricPotentialCh /// A Duration with the specified unit. public ElectricPotentialChangeRate ToUnit(ElectricPotentialChangeRateUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricPotentialChangeRate(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -371,7 +369,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricPotentialChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotentialDc.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotentialDc.g.cs index 72da488327..e0c291d885 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotentialDc.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricPotentialDc.g.cs @@ -156,7 +156,7 @@ public static ElectricPotentialDc From(double value, ElectricPotentialDcUnit fro /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricPotentialDcUnit unit) => GetValueAs(unit); + public double As(ElectricPotentialDcUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -164,12 +164,10 @@ public static ElectricPotentialDc From(double value, ElectricPotentialDcUnit fro /// A Duration with the specified unit. public ElectricPotentialDc ToUnit(ElectricPotentialDcUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricPotentialDc(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -191,7 +189,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricPotentialDcUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricResistance.g.cs index c45b3ccbe5..b81be57112 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -167,7 +167,7 @@ public static ElectricResistance From(double value, ElectricResistanceUnit fromU /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricResistanceUnit unit) => GetValueAs(unit); + public double As(ElectricResistanceUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -175,12 +175,10 @@ public static ElectricResistance From(double value, ElectricResistanceUnit fromU /// A Duration with the specified unit. public ElectricResistance ToUnit(ElectricResistanceUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricResistance(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -203,7 +201,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricResistanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricResistivity.g.cs index 7963136182..e7dd622b3a 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -258,7 +258,7 @@ public static ElectricResistivity From(double value, ElectricResistivityUnit fro /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricResistivityUnit unit) => GetValueAs(unit); + public double As(ElectricResistivityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -266,12 +266,10 @@ public static ElectricResistivity From(double value, ElectricResistivityUnit fro /// A Duration with the specified unit. public ElectricResistivity ToUnit(ElectricResistivityUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricResistivity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -302,7 +300,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricResistivityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs index 1feb4fc190..e5fb9bcf49 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs @@ -137,7 +137,7 @@ public static ElectricSurfaceChargeDensity From(double value, ElectricSurfaceCha /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ElectricSurfaceChargeDensityUnit unit) => GetValueAs(unit); + public double As(ElectricSurfaceChargeDensityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -145,12 +145,10 @@ public static ElectricSurfaceChargeDensity From(double value, ElectricSurfaceCha /// A Duration with the specified unit. public ElectricSurfaceChargeDensity ToUnit(ElectricSurfaceChargeDensityUnit unit) { - var convertedValue = GetValueAs(unit); return new ElectricSurfaceChargeDensity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -170,7 +168,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ElectricSurfaceChargeDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Energy.g.cs index 5cbe03d497..ddc221eec5 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Energy.g.cs @@ -497,7 +497,7 @@ public static Energy From(double value, EnergyUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(EnergyUnit unit) => GetValueAs(unit); + public double As(EnergyUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -505,12 +505,10 @@ public static Energy From(double value, EnergyUnit fromUnit) /// A Duration with the specified unit. public Energy ToUnit(EnergyUnit unit) { - var convertedValue = GetValueAs(unit); return new Energy(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -563,7 +561,7 @@ private double GetValueInBaseUnit() private double GetValueAs(EnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Entropy.g.cs index 27418a3c7e..6ef8a8e3ac 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Entropy.g.cs @@ -178,7 +178,7 @@ public static Entropy From(double value, EntropyUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(EntropyUnit unit) => GetValueAs(unit); + public double As(EntropyUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -186,12 +186,10 @@ public static Entropy From(double value, EntropyUnit fromUnit) /// A Duration with the specified unit. public Entropy ToUnit(EntropyUnit unit) { - var convertedValue = GetValueAs(unit); return new Entropy(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -215,7 +213,7 @@ private double GetValueInBaseUnit() private double GetValueAs(EntropyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Force.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Force.g.cs index 04ecaf4d37..716e2617ea 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Force.g.cs @@ -266,7 +266,7 @@ public static Force From(double value, ForceUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ForceUnit unit) => GetValueAs(unit); + public double As(ForceUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -274,12 +274,10 @@ public static Force From(double value, ForceUnit fromUnit) /// A Duration with the specified unit. public Force ToUnit(ForceUnit unit) { - var convertedValue = GetValueAs(unit); return new Force(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -311,7 +309,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ForceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ForceChangeRate.g.cs index d4bc1f5f6c..dc1a6cb002 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -266,7 +266,7 @@ public static ForceChangeRate From(double value, ForceChangeRateUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ForceChangeRateUnit unit) => GetValueAs(unit); + public double As(ForceChangeRateUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -274,12 +274,10 @@ public static ForceChangeRate From(double value, ForceChangeRateUnit fromUnit) /// A Duration with the specified unit. public ForceChangeRate ToUnit(ForceChangeRateUnit unit) { - var convertedValue = GetValueAs(unit); return new ForceChangeRate(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -311,7 +309,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ForceChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ForcePerLength.g.cs index 4e901f4b4b..3616342038 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -519,7 +519,7 @@ public static ForcePerLength From(double value, ForcePerLengthUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ForcePerLengthUnit unit) => GetValueAs(unit); + public double As(ForcePerLengthUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -527,12 +527,10 @@ public static ForcePerLength From(double value, ForcePerLengthUnit fromUnit) /// A Duration with the specified unit. public ForcePerLength ToUnit(ForcePerLengthUnit unit) { - var convertedValue = GetValueAs(unit); return new ForcePerLength(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -587,7 +585,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ForcePerLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Frequency.g.cs index 8e93966048..d0bb679fdc 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Frequency.g.cs @@ -222,7 +222,7 @@ public static Frequency From(double value, FrequencyUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(FrequencyUnit unit) => GetValueAs(unit); + public double As(FrequencyUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -230,12 +230,10 @@ public static Frequency From(double value, FrequencyUnit fromUnit) /// A Duration with the specified unit. public Frequency ToUnit(FrequencyUnit unit) { - var convertedValue = GetValueAs(unit); return new Frequency(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -263,7 +261,7 @@ private double GetValueInBaseUnit() private double GetValueAs(FrequencyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/FuelEfficiency.g.cs index 2807584287..c737175658 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/FuelEfficiency.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/FuelEfficiency.g.cs @@ -148,7 +148,7 @@ public static FuelEfficiency From(double value, FuelEfficiencyUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(FuelEfficiencyUnit unit) => GetValueAs(unit); + public double As(FuelEfficiencyUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -156,12 +156,10 @@ public static FuelEfficiency From(double value, FuelEfficiencyUnit fromUnit) /// A Duration with the specified unit. public FuelEfficiency ToUnit(FuelEfficiencyUnit unit) { - var convertedValue = GetValueAs(unit); return new FuelEfficiency(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -182,7 +180,7 @@ private double GetValueInBaseUnit() private double GetValueAs(FuelEfficiencyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/HeatFlux.g.cs index 3d8641875b..c6e1975ea4 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/HeatFlux.g.cs @@ -299,7 +299,7 @@ public static HeatFlux From(double value, HeatFluxUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(HeatFluxUnit unit) => GetValueAs(unit); + public double As(HeatFluxUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -307,12 +307,10 @@ public static HeatFlux From(double value, HeatFluxUnit fromUnit) /// A Duration with the specified unit. public HeatFlux ToUnit(HeatFluxUnit unit) { - var convertedValue = GetValueAs(unit); return new HeatFlux(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -347,7 +345,7 @@ private double GetValueInBaseUnit() private double GetValueAs(HeatFluxUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs index df7ce8d19d..7c1be69980 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs @@ -134,7 +134,7 @@ public static HeatTransferCoefficient From(double value, HeatTransferCoefficient /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(HeatTransferCoefficientUnit unit) => GetValueAs(unit); + public double As(HeatTransferCoefficientUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -142,12 +142,10 @@ public static HeatTransferCoefficient From(double value, HeatTransferCoefficient /// A Duration with the specified unit. public HeatTransferCoefficient ToUnit(HeatTransferCoefficientUnit unit) { - var convertedValue = GetValueAs(unit); return new HeatTransferCoefficient(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -167,7 +165,7 @@ private double GetValueInBaseUnit() private double GetValueAs(HeatTransferCoefficientUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Illuminance.g.cs index dec0eefe31..9eb01b1992 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Illuminance.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Illuminance.g.cs @@ -148,7 +148,7 @@ public static Illuminance From(double value, IlluminanceUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(IlluminanceUnit unit) => GetValueAs(unit); + public double As(IlluminanceUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -156,12 +156,10 @@ public static Illuminance From(double value, IlluminanceUnit fromUnit) /// A Duration with the specified unit. public Illuminance ToUnit(IlluminanceUnit unit) { - var convertedValue = GetValueAs(unit); return new Illuminance(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -182,7 +180,7 @@ private double GetValueInBaseUnit() private double GetValueAs(IlluminanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Information.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Information.g.cs index f7c1bae25a..ae511027a1 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Information.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Information.g.cs @@ -387,7 +387,7 @@ public static Information From(double value, InformationUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(InformationUnit unit) => GetValueAs(unit); + public double As(InformationUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -395,12 +395,10 @@ public static Information From(double value, InformationUnit fromUnit) /// A Duration with the specified unit. public Information ToUnit(InformationUnit unit) { - var convertedValue = GetValueAs(unit); return new Information(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -443,7 +441,7 @@ private double GetValueInBaseUnit() private double GetValueAs(InformationUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Irradiance.g.cs index 485557b649..426d8359d3 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Irradiance.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Irradiance.g.cs @@ -255,7 +255,7 @@ public static Irradiance From(double value, IrradianceUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(IrradianceUnit unit) => GetValueAs(unit); + public double As(IrradianceUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -263,12 +263,10 @@ public static Irradiance From(double value, IrradianceUnit fromUnit) /// A Duration with the specified unit. public Irradiance ToUnit(IrradianceUnit unit) { - var convertedValue = GetValueAs(unit); return new Irradiance(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -299,7 +297,7 @@ private double GetValueInBaseUnit() private double GetValueAs(IrradianceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Irradiation.g.cs index 6592c201d4..6e21675916 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Irradiation.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Irradiation.g.cs @@ -181,7 +181,7 @@ public static Irradiation From(double value, IrradiationUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(IrradiationUnit unit) => GetValueAs(unit); + public double As(IrradiationUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -189,12 +189,10 @@ public static Irradiation From(double value, IrradiationUnit fromUnit) /// A Duration with the specified unit. public Irradiation ToUnit(IrradiationUnit unit) { - var convertedValue = GetValueAs(unit); return new Irradiation(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -218,7 +216,7 @@ private double GetValueInBaseUnit() private double GetValueAs(IrradiationUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/KinematicViscosity.g.cs index 6e71268e2a..8943529b2a 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -203,7 +203,7 @@ public static KinematicViscosity From(double value, KinematicViscosityUnit fromU /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(KinematicViscosityUnit unit) => GetValueAs(unit); + public double As(KinematicViscosityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -211,12 +211,10 @@ public static KinematicViscosity From(double value, KinematicViscosityUnit fromU /// A Duration with the specified unit. public KinematicViscosity ToUnit(KinematicViscosityUnit unit) { - var convertedValue = GetValueAs(unit); return new KinematicViscosity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -242,7 +240,7 @@ private double GetValueInBaseUnit() private double GetValueAs(KinematicViscosityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/LapseRate.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/LapseRate.g.cs index a6f7ef5674..1e7fb4acba 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/LapseRate.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/LapseRate.g.cs @@ -112,7 +112,7 @@ public static LapseRate From(double value, LapseRateUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(LapseRateUnit unit) => GetValueAs(unit); + public double As(LapseRateUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -120,12 +120,10 @@ public static LapseRate From(double value, LapseRateUnit fromUnit) /// A Duration with the specified unit. public LapseRate ToUnit(LapseRateUnit unit) { - var convertedValue = GetValueAs(unit); return new LapseRate(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -143,7 +141,7 @@ private double GetValueInBaseUnit() private double GetValueAs(LapseRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Length.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Length.g.cs index 6f88bf443d..22fb06e39f 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Length.g.cs @@ -464,7 +464,7 @@ public static Length From(double value, LengthUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(LengthUnit unit) => GetValueAs(unit); + public double As(LengthUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -472,12 +472,10 @@ public static Length From(double value, LengthUnit fromUnit) /// A Duration with the specified unit. public Length ToUnit(LengthUnit unit) { - var convertedValue = GetValueAs(unit); return new Length(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -527,7 +525,7 @@ private double GetValueInBaseUnit() private double GetValueAs(LengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Level.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Level.g.cs index 8f6433b13f..d938fb9c1d 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Level.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Level.g.cs @@ -123,7 +123,7 @@ public static Level From(double value, LevelUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(LevelUnit unit) => GetValueAs(unit); + public double As(LevelUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -131,12 +131,10 @@ public static Level From(double value, LevelUnit fromUnit) /// A Duration with the specified unit. public Level ToUnit(LevelUnit unit) { - var convertedValue = GetValueAs(unit); return new Level(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -155,7 +153,7 @@ private double GetValueInBaseUnit() private double GetValueAs(LevelUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/LinearDensity.g.cs index 3b7ffa5188..a39f73aa19 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/LinearDensity.g.cs @@ -258,7 +258,7 @@ public static LinearDensity From(double value, LinearDensityUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(LinearDensityUnit unit) => GetValueAs(unit); + public double As(LinearDensityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -266,12 +266,10 @@ public static LinearDensity From(double value, LinearDensityUnit fromUnit) /// A Duration with the specified unit. public LinearDensity ToUnit(LinearDensityUnit unit) { - var convertedValue = GetValueAs(unit); return new LinearDensity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -302,7 +300,7 @@ private double GetValueInBaseUnit() private double GetValueAs(LinearDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/LinearPowerDensity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/LinearPowerDensity.g.cs index f29ab637aa..00286dd011 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/LinearPowerDensity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/LinearPowerDensity.g.cs @@ -379,7 +379,7 @@ public static LinearPowerDensity From(double value, LinearPowerDensityUnit fromU /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(LinearPowerDensityUnit unit) => GetValueAs(unit); + public double As(LinearPowerDensityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -387,12 +387,10 @@ public static LinearPowerDensity From(double value, LinearPowerDensityUnit fromU /// A Duration with the specified unit. public LinearPowerDensity ToUnit(LinearPowerDensityUnit unit) { - var convertedValue = GetValueAs(unit); return new LinearPowerDensity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -434,7 +432,7 @@ private double GetValueInBaseUnit() private double GetValueAs(LinearPowerDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Luminosity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Luminosity.g.cs index e400ef52e8..77c6220740 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Luminosity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Luminosity.g.cs @@ -258,7 +258,7 @@ public static Luminosity From(double value, LuminosityUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(LuminosityUnit unit) => GetValueAs(unit); + public double As(LuminosityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -266,12 +266,10 @@ public static Luminosity From(double value, LuminosityUnit fromUnit) /// A Duration with the specified unit. public Luminosity ToUnit(LuminosityUnit unit) { - var convertedValue = GetValueAs(unit); return new Luminosity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -302,7 +300,7 @@ private double GetValueInBaseUnit() private double GetValueAs(LuminosityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/LuminousFlux.g.cs index c7b1231437..801b11af71 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/LuminousFlux.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/LuminousFlux.g.cs @@ -115,7 +115,7 @@ public static LuminousFlux From(double value, LuminousFluxUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(LuminousFluxUnit unit) => GetValueAs(unit); + public double As(LuminousFluxUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -123,12 +123,10 @@ public static LuminousFlux From(double value, LuminousFluxUnit fromUnit) /// A Duration with the specified unit. public LuminousFlux ToUnit(LuminousFluxUnit unit) { - var convertedValue = GetValueAs(unit); return new LuminousFlux(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -146,7 +144,7 @@ private double GetValueInBaseUnit() private double GetValueAs(LuminousFluxUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/LuminousIntensity.g.cs index a058ebe49c..55a7f4b904 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -115,7 +115,7 @@ public static LuminousIntensity From(double value, LuminousIntensityUnit fromUni /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(LuminousIntensityUnit unit) => GetValueAs(unit); + public double As(LuminousIntensityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -123,12 +123,10 @@ public static LuminousIntensity From(double value, LuminousIntensityUnit fromUni /// A Duration with the specified unit. public LuminousIntensity ToUnit(LuminousIntensityUnit unit) { - var convertedValue = GetValueAs(unit); return new LuminousIntensity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -146,7 +144,7 @@ private double GetValueInBaseUnit() private double GetValueAs(LuminousIntensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MagneticField.g.cs index 8d512557d6..d38d1b548d 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MagneticField.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MagneticField.g.cs @@ -170,7 +170,7 @@ public static MagneticField From(double value, MagneticFieldUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MagneticFieldUnit unit) => GetValueAs(unit); + public double As(MagneticFieldUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -178,12 +178,10 @@ public static MagneticField From(double value, MagneticFieldUnit fromUnit) /// A Duration with the specified unit. public MagneticField ToUnit(MagneticFieldUnit unit) { - var convertedValue = GetValueAs(unit); return new MagneticField(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -206,7 +204,7 @@ private double GetValueInBaseUnit() private double GetValueAs(MagneticFieldUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MagneticFlux.g.cs index eb6957ae9e..b019231fb1 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MagneticFlux.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MagneticFlux.g.cs @@ -115,7 +115,7 @@ public static MagneticFlux From(double value, MagneticFluxUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MagneticFluxUnit unit) => GetValueAs(unit); + public double As(MagneticFluxUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -123,12 +123,10 @@ public static MagneticFlux From(double value, MagneticFluxUnit fromUnit) /// A Duration with the specified unit. public MagneticFlux ToUnit(MagneticFluxUnit unit) { - var convertedValue = GetValueAs(unit); return new MagneticFlux(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -146,7 +144,7 @@ private double GetValueInBaseUnit() private double GetValueAs(MagneticFluxUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Magnetization.g.cs index d1b731691f..591de5b52e 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Magnetization.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Magnetization.g.cs @@ -115,7 +115,7 @@ public static Magnetization From(double value, MagnetizationUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MagnetizationUnit unit) => GetValueAs(unit); + public double As(MagnetizationUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -123,12 +123,10 @@ public static Magnetization From(double value, MagnetizationUnit fromUnit) /// A Duration with the specified unit. public Magnetization ToUnit(MagnetizationUnit unit) { - var convertedValue = GetValueAs(unit); return new Magnetization(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -146,7 +144,7 @@ private double GetValueInBaseUnit() private double GetValueAs(MagnetizationUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Mass.g.cs index 1df3d359d1..d19c47fdd3 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Mass.g.cs @@ -376,7 +376,7 @@ public static Mass From(double value, MassUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MassUnit unit) => GetValueAs(unit); + public double As(MassUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -384,12 +384,10 @@ public static Mass From(double value, MassUnit fromUnit) /// A Duration with the specified unit. public Mass ToUnit(MassUnit unit) { - var convertedValue = GetValueAs(unit); return new Mass(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -431,7 +429,7 @@ private double GetValueInBaseUnit() private double GetValueAs(MassUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassConcentration.g.cs index 54416eb19b..5a8b934154 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassConcentration.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassConcentration.g.cs @@ -643,7 +643,7 @@ public static MassConcentration From(double value, MassConcentrationUnit fromUni /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MassConcentrationUnit unit) => GetValueAs(unit); + public double As(MassConcentrationUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -651,12 +651,10 @@ public static MassConcentration From(double value, MassConcentrationUnit fromUni /// A Duration with the specified unit. public MassConcentration ToUnit(MassConcentrationUnit unit) { - var convertedValue = GetValueAs(unit); return new MassConcentration(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -722,7 +720,7 @@ private double GetValueInBaseUnit() private double GetValueAs(MassConcentrationUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassFlow.g.cs index 4ef935431b..61bb45037c 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassFlow.g.cs @@ -464,7 +464,7 @@ public static MassFlow From(double value, MassFlowUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MassFlowUnit unit) => GetValueAs(unit); + public double As(MassFlowUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -472,12 +472,10 @@ public static MassFlow From(double value, MassFlowUnit fromUnit) /// A Duration with the specified unit. public MassFlow ToUnit(MassFlowUnit unit) { - var convertedValue = GetValueAs(unit); return new MassFlow(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -527,7 +525,7 @@ private double GetValueInBaseUnit() private double GetValueAs(MassFlowUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassFlux.g.cs index d0aceaa85f..5bc7092e15 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassFlux.g.cs @@ -233,7 +233,7 @@ public static MassFlux From(double value, MassFluxUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MassFluxUnit unit) => GetValueAs(unit); + public double As(MassFluxUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -241,12 +241,10 @@ public static MassFlux From(double value, MassFluxUnit fromUnit) /// A Duration with the specified unit. public MassFlux ToUnit(MassFluxUnit unit) { - var convertedValue = GetValueAs(unit); return new MassFlux(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -275,7 +273,7 @@ private double GetValueInBaseUnit() private double GetValueAs(MassFluxUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassFraction.g.cs index c78426464c..0a916df49c 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassFraction.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassFraction.g.cs @@ -368,7 +368,7 @@ public static MassFraction From(double value, MassFractionUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MassFractionUnit unit) => GetValueAs(unit); + public double As(MassFractionUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -376,12 +376,10 @@ public static MassFraction From(double value, MassFractionUnit fromUnit) /// A Duration with the specified unit. public MassFraction ToUnit(MassFractionUnit unit) { - var convertedValue = GetValueAs(unit); return new MassFraction(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -422,7 +420,7 @@ private double GetValueInBaseUnit() private double GetValueAs(MassFractionUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassMomentOfInertia.g.cs index 40c820205a..ea661e4ef8 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassMomentOfInertia.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MassMomentOfInertia.g.cs @@ -409,7 +409,7 @@ public static MassMomentOfInertia From(double value, MassMomentOfInertiaUnit fro /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MassMomentOfInertiaUnit unit) => GetValueAs(unit); + public double As(MassMomentOfInertiaUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -417,12 +417,10 @@ public static MassMomentOfInertia From(double value, MassMomentOfInertiaUnit fro /// A Duration with the specified unit. public MassMomentOfInertia ToUnit(MassMomentOfInertiaUnit unit) { - var convertedValue = GetValueAs(unit); return new MassMomentOfInertia(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -467,7 +465,7 @@ private double GetValueInBaseUnit() private double GetValueAs(MassMomentOfInertiaUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MolarEnergy.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MolarEnergy.g.cs index 17ea343848..8a4ed27258 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MolarEnergy.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MolarEnergy.g.cs @@ -134,7 +134,7 @@ public static MolarEnergy From(double value, MolarEnergyUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MolarEnergyUnit unit) => GetValueAs(unit); + public double As(MolarEnergyUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -142,12 +142,10 @@ public static MolarEnergy From(double value, MolarEnergyUnit fromUnit) /// A Duration with the specified unit. public MolarEnergy ToUnit(MolarEnergyUnit unit) { - var convertedValue = GetValueAs(unit); return new MolarEnergy(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -167,7 +165,7 @@ private double GetValueInBaseUnit() private double GetValueAs(MolarEnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MolarEntropy.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MolarEntropy.g.cs index 74f6ecb750..edd6d47b6a 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MolarEntropy.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MolarEntropy.g.cs @@ -134,7 +134,7 @@ public static MolarEntropy From(double value, MolarEntropyUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MolarEntropyUnit unit) => GetValueAs(unit); + public double As(MolarEntropyUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -142,12 +142,10 @@ public static MolarEntropy From(double value, MolarEntropyUnit fromUnit) /// A Duration with the specified unit. public MolarEntropy ToUnit(MolarEntropyUnit unit) { - var convertedValue = GetValueAs(unit); return new MolarEntropy(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -167,7 +165,7 @@ private double GetValueInBaseUnit() private double GetValueAs(MolarEntropyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MolarMass.g.cs index 136977d53a..2bbf148135 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/MolarMass.g.cs @@ -233,7 +233,7 @@ public static MolarMass From(double value, MolarMassUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MolarMassUnit unit) => GetValueAs(unit); + public double As(MolarMassUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -241,12 +241,10 @@ public static MolarMass From(double value, MolarMassUnit fromUnit) /// A Duration with the specified unit. public MolarMass ToUnit(MolarMassUnit unit) { - var convertedValue = GetValueAs(unit); return new MolarMass(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -275,7 +273,7 @@ private double GetValueInBaseUnit() private double GetValueAs(MolarMassUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Molarity.g.cs index 6b0ce795ec..4aff80fa5a 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Molarity.g.cs @@ -192,7 +192,7 @@ public static Molarity From(double value, MolarityUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(MolarityUnit unit) => GetValueAs(unit); + public double As(MolarityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -200,12 +200,10 @@ public static Molarity From(double value, MolarityUnit fromUnit) /// A Duration with the specified unit. public Molarity ToUnit(MolarityUnit unit) { - var convertedValue = GetValueAs(unit); return new Molarity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -238,7 +236,7 @@ private double GetValueInBaseUnit() private double GetValueAs(MolarityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Permeability.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Permeability.g.cs index ce6def0ba1..eb0589d721 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Permeability.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Permeability.g.cs @@ -115,7 +115,7 @@ public static Permeability From(double value, PermeabilityUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(PermeabilityUnit unit) => GetValueAs(unit); + public double As(PermeabilityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -123,12 +123,10 @@ public static Permeability From(double value, PermeabilityUnit fromUnit) /// A Duration with the specified unit. public Permeability ToUnit(PermeabilityUnit unit) { - var convertedValue = GetValueAs(unit); return new Permeability(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -146,7 +144,7 @@ private double GetValueInBaseUnit() private double GetValueAs(PermeabilityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Permittivity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Permittivity.g.cs index 2b93b1d8b0..83082319c8 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Permittivity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Permittivity.g.cs @@ -115,7 +115,7 @@ public static Permittivity From(double value, PermittivityUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(PermittivityUnit unit) => GetValueAs(unit); + public double As(PermittivityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -123,12 +123,10 @@ public static Permittivity From(double value, PermittivityUnit fromUnit) /// A Duration with the specified unit. public Permittivity ToUnit(PermittivityUnit unit) { - var convertedValue = GetValueAs(unit); return new Permittivity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -146,7 +144,7 @@ private double GetValueInBaseUnit() private double GetValueAs(PermittivityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Power.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Power.g.cs index c42445613e..35e3056626 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Power.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Power.g.cs @@ -376,7 +376,7 @@ public static Power From(double value, PowerUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(PowerUnit unit) => GetValueAs(unit); + public double As(PowerUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -384,12 +384,10 @@ public static Power From(double value, PowerUnit fromUnit) /// A Duration with the specified unit. public Power ToUnit(PowerUnit unit) { - var convertedValue = GetValueAs(unit); return new Power(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -431,7 +429,7 @@ private double GetValueInBaseUnit() private double GetValueAs(PowerUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/PowerDensity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/PowerDensity.g.cs index 6a82ffc0cd..e9134ea091 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/PowerDensity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/PowerDensity.g.cs @@ -585,7 +585,7 @@ public static PowerDensity From(double value, PowerDensityUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(PowerDensityUnit unit) => GetValueAs(unit); + public double As(PowerDensityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -593,12 +593,10 @@ public static PowerDensity From(double value, PowerDensityUnit fromUnit) /// A Duration with the specified unit. public PowerDensity ToUnit(PowerDensityUnit unit) { - var convertedValue = GetValueAs(unit); return new PowerDensity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -659,7 +657,7 @@ private double GetValueInBaseUnit() private double GetValueAs(PowerDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/PowerRatio.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/PowerRatio.g.cs index 576ad5bc25..c374d0b712 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/PowerRatio.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/PowerRatio.g.cs @@ -123,7 +123,7 @@ public static PowerRatio From(double value, PowerRatioUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(PowerRatioUnit unit) => GetValueAs(unit); + public double As(PowerRatioUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -131,12 +131,10 @@ public static PowerRatio From(double value, PowerRatioUnit fromUnit) /// A Duration with the specified unit. public PowerRatio ToUnit(PowerRatioUnit unit) { - var convertedValue = GetValueAs(unit); return new PowerRatio(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -155,7 +153,7 @@ private double GetValueInBaseUnit() private double GetValueAs(PowerRatioUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Pressure.g.cs index 8b2a43e8f2..259b7e8a30 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Pressure.g.cs @@ -596,7 +596,7 @@ public static Pressure From(double value, PressureUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(PressureUnit unit) => GetValueAs(unit); + public double As(PressureUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -604,12 +604,10 @@ public static Pressure From(double value, PressureUnit fromUnit) /// A Duration with the specified unit. public Pressure ToUnit(PressureUnit unit) { - var convertedValue = GetValueAs(unit); return new Pressure(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -671,7 +669,7 @@ private double GetValueInBaseUnit() private double GetValueAs(PressureUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/PressureChangeRate.g.cs index a8c6d6bc40..4ff1675495 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -255,7 +255,7 @@ public static PressureChangeRate From(double value, PressureChangeRateUnit fromU /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(PressureChangeRateUnit unit) => GetValueAs(unit); + public double As(PressureChangeRateUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -263,12 +263,10 @@ public static PressureChangeRate From(double value, PressureChangeRateUnit fromU /// A Duration with the specified unit. public PressureChangeRate ToUnit(PressureChangeRateUnit unit) { - var convertedValue = GetValueAs(unit); return new PressureChangeRate(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -299,7 +297,7 @@ private double GetValueInBaseUnit() private double GetValueAs(PressureChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Ratio.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Ratio.g.cs index 4f6c208709..49a2e9d28f 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Ratio.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Ratio.g.cs @@ -167,7 +167,7 @@ public static Ratio From(double value, RatioUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(RatioUnit unit) => GetValueAs(unit); + public double As(RatioUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -175,12 +175,10 @@ public static Ratio From(double value, RatioUnit fromUnit) /// A Duration with the specified unit. public Ratio ToUnit(RatioUnit unit) { - var convertedValue = GetValueAs(unit); return new Ratio(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -203,7 +201,7 @@ private double GetValueInBaseUnit() private double GetValueAs(RatioUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/RatioChangeRate.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/RatioChangeRate.g.cs index 998acbb4ee..5ea01f41a5 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/RatioChangeRate.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/RatioChangeRate.g.cs @@ -123,7 +123,7 @@ public static RatioChangeRate From(double value, RatioChangeRateUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(RatioChangeRateUnit unit) => GetValueAs(unit); + public double As(RatioChangeRateUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -131,12 +131,10 @@ public static RatioChangeRate From(double value, RatioChangeRateUnit fromUnit) /// A Duration with the specified unit. public RatioChangeRate ToUnit(RatioChangeRateUnit unit) { - var convertedValue = GetValueAs(unit); return new RatioChangeRate(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -155,7 +153,7 @@ private double GetValueInBaseUnit() private double GetValueAs(RatioChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ReactiveEnergy.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ReactiveEnergy.g.cs index e14b88f04b..0f59ca7797 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ReactiveEnergy.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ReactiveEnergy.g.cs @@ -134,7 +134,7 @@ public static ReactiveEnergy From(double value, ReactiveEnergyUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ReactiveEnergyUnit unit) => GetValueAs(unit); + public double As(ReactiveEnergyUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -142,12 +142,10 @@ public static ReactiveEnergy From(double value, ReactiveEnergyUnit fromUnit) /// A Duration with the specified unit. public ReactiveEnergy ToUnit(ReactiveEnergyUnit unit) { - var convertedValue = GetValueAs(unit); return new ReactiveEnergy(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -167,7 +165,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ReactiveEnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ReactivePower.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ReactivePower.g.cs index 770f5ebaf5..100faa396f 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ReactivePower.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ReactivePower.g.cs @@ -145,7 +145,7 @@ public static ReactivePower From(double value, ReactivePowerUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ReactivePowerUnit unit) => GetValueAs(unit); + public double As(ReactivePowerUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -153,12 +153,10 @@ public static ReactivePower From(double value, ReactivePowerUnit fromUnit) /// A Duration with the specified unit. public ReactivePower ToUnit(ReactivePowerUnit unit) { - var convertedValue = GetValueAs(unit); return new ReactivePower(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -179,7 +177,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ReactivePowerUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ReciprocalArea.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ReciprocalArea.g.cs index 0941da4332..36e47708f4 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ReciprocalArea.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ReciprocalArea.g.cs @@ -225,7 +225,7 @@ public static ReciprocalArea From(double value, ReciprocalAreaUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ReciprocalAreaUnit unit) => GetValueAs(unit); + public double As(ReciprocalAreaUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -233,12 +233,10 @@ public static ReciprocalArea From(double value, ReciprocalAreaUnit fromUnit) /// A Duration with the specified unit. public ReciprocalArea ToUnit(ReciprocalAreaUnit unit) { - var convertedValue = GetValueAs(unit); return new ReciprocalArea(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -266,7 +264,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ReciprocalAreaUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ReciprocalLength.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ReciprocalLength.g.cs index 273c2e6e9f..8253de01c1 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ReciprocalLength.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ReciprocalLength.g.cs @@ -214,7 +214,7 @@ public static ReciprocalLength From(double value, ReciprocalLengthUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ReciprocalLengthUnit unit) => GetValueAs(unit); + public double As(ReciprocalLengthUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -222,12 +222,10 @@ public static ReciprocalLength From(double value, ReciprocalLengthUnit fromUnit) /// A Duration with the specified unit. public ReciprocalLength ToUnit(ReciprocalLengthUnit unit) { - var convertedValue = GetValueAs(unit); return new ReciprocalLength(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -254,7 +252,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ReciprocalLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/RelativeHumidity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/RelativeHumidity.g.cs index d788971841..ed69e747bf 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/RelativeHumidity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/RelativeHumidity.g.cs @@ -112,7 +112,7 @@ public static RelativeHumidity From(double value, RelativeHumidityUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(RelativeHumidityUnit unit) => GetValueAs(unit); + public double As(RelativeHumidityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -120,12 +120,10 @@ public static RelativeHumidity From(double value, RelativeHumidityUnit fromUnit) /// A Duration with the specified unit. public RelativeHumidity ToUnit(RelativeHumidityUnit unit) { - var convertedValue = GetValueAs(unit); return new RelativeHumidity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -143,7 +141,7 @@ private double GetValueInBaseUnit() private double GetValueAs(RelativeHumidityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/RotationalAcceleration.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/RotationalAcceleration.g.cs index 9e51de985b..782a1743ec 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/RotationalAcceleration.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/RotationalAcceleration.g.cs @@ -145,7 +145,7 @@ public static RotationalAcceleration From(double value, RotationalAccelerationUn /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(RotationalAccelerationUnit unit) => GetValueAs(unit); + public double As(RotationalAccelerationUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -153,12 +153,10 @@ public static RotationalAcceleration From(double value, RotationalAccelerationUn /// A Duration with the specified unit. public RotationalAcceleration ToUnit(RotationalAccelerationUnit unit) { - var convertedValue = GetValueAs(unit); return new RotationalAcceleration(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -179,7 +177,7 @@ private double GetValueInBaseUnit() private double GetValueAs(RotationalAccelerationUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/RotationalSpeed.g.cs index 3b73371df6..6073d25e12 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -244,7 +244,7 @@ public static RotationalSpeed From(double value, RotationalSpeedUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(RotationalSpeedUnit unit) => GetValueAs(unit); + public double As(RotationalSpeedUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -252,12 +252,10 @@ public static RotationalSpeed From(double value, RotationalSpeedUnit fromUnit) /// A Duration with the specified unit. public RotationalSpeed ToUnit(RotationalSpeedUnit unit) { - var convertedValue = GetValueAs(unit); return new RotationalSpeed(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -287,7 +285,7 @@ private double GetValueInBaseUnit() private double GetValueAs(RotationalSpeedUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/RotationalStiffness.g.cs index a47c25f2a3..593c7614f4 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -464,7 +464,7 @@ public static RotationalStiffness From(double value, RotationalStiffnessUnit fro /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(RotationalStiffnessUnit unit) => GetValueAs(unit); + public double As(RotationalStiffnessUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -472,12 +472,10 @@ public static RotationalStiffness From(double value, RotationalStiffnessUnit fro /// A Duration with the specified unit. public RotationalStiffness ToUnit(RotationalStiffnessUnit unit) { - var convertedValue = GetValueAs(unit); return new RotationalStiffness(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -527,7 +525,7 @@ private double GetValueInBaseUnit() private double GetValueAs(RotationalStiffnessUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs index 41c43cb7b5..1da7148e0e 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -156,7 +156,7 @@ public static RotationalStiffnessPerLength From(double value, RotationalStiffnes /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(RotationalStiffnessPerLengthUnit unit) => GetValueAs(unit); + public double As(RotationalStiffnessPerLengthUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -164,12 +164,10 @@ public static RotationalStiffnessPerLength From(double value, RotationalStiffnes /// A Duration with the specified unit. public RotationalStiffnessPerLength ToUnit(RotationalStiffnessPerLengthUnit unit) { - var convertedValue = GetValueAs(unit); return new RotationalStiffnessPerLength(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -191,7 +189,7 @@ private double GetValueInBaseUnit() private double GetValueAs(RotationalStiffnessPerLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Scalar.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Scalar.g.cs index 3e6c6fd5d5..2ab93c4962 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Scalar.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Scalar.g.cs @@ -112,7 +112,7 @@ public static Scalar From(double value, ScalarUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ScalarUnit unit) => GetValueAs(unit); + public double As(ScalarUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -120,12 +120,10 @@ public static Scalar From(double value, ScalarUnit fromUnit) /// A Duration with the specified unit. public Scalar ToUnit(ScalarUnit unit) { - var convertedValue = GetValueAs(unit); return new Scalar(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -143,7 +141,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ScalarUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/SolidAngle.g.cs index 9c51f02470..55658df3d2 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/SolidAngle.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/SolidAngle.g.cs @@ -115,7 +115,7 @@ public static SolidAngle From(double value, SolidAngleUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(SolidAngleUnit unit) => GetValueAs(unit); + public double As(SolidAngleUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -123,12 +123,10 @@ public static SolidAngle From(double value, SolidAngleUnit fromUnit) /// A Duration with the specified unit. public SolidAngle ToUnit(SolidAngleUnit unit) { - var convertedValue = GetValueAs(unit); return new SolidAngle(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -146,7 +144,7 @@ private double GetValueInBaseUnit() private double GetValueAs(SolidAngleUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificEnergy.g.cs index 32fc74dcea..b6c763400d 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -379,7 +379,7 @@ public static SpecificEnergy From(double value, SpecificEnergyUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(SpecificEnergyUnit unit) => GetValueAs(unit); + public double As(SpecificEnergyUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -387,12 +387,10 @@ public static SpecificEnergy From(double value, SpecificEnergyUnit fromUnit) /// A Duration with the specified unit. public SpecificEnergy ToUnit(SpecificEnergyUnit unit) { - var convertedValue = GetValueAs(unit); return new SpecificEnergy(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -434,7 +432,7 @@ private double GetValueInBaseUnit() private double GetValueAs(SpecificEnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificEntropy.g.cs index 16bf4d39de..5f149aa9ee 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -200,7 +200,7 @@ public static SpecificEntropy From(double value, SpecificEntropyUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(SpecificEntropyUnit unit) => GetValueAs(unit); + public double As(SpecificEntropyUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -208,12 +208,10 @@ public static SpecificEntropy From(double value, SpecificEntropyUnit fromUnit) /// A Duration with the specified unit. public SpecificEntropy ToUnit(SpecificEntropyUnit unit) { - var convertedValue = GetValueAs(unit); return new SpecificEntropy(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -239,7 +237,7 @@ private double GetValueInBaseUnit() private double GetValueAs(SpecificEntropyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs index 133149d969..1abee426d5 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs @@ -148,7 +148,7 @@ public static SpecificFuelConsumption From(double value, SpecificFuelConsumption /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(SpecificFuelConsumptionUnit unit) => GetValueAs(unit); + public double As(SpecificFuelConsumptionUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -156,12 +156,10 @@ public static SpecificFuelConsumption From(double value, SpecificFuelConsumption /// A Duration with the specified unit. public SpecificFuelConsumption ToUnit(SpecificFuelConsumptionUnit unit) { - var convertedValue = GetValueAs(unit); return new SpecificFuelConsumption(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -182,7 +180,7 @@ private double GetValueInBaseUnit() private double GetValueAs(SpecificFuelConsumptionUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificVolume.g.cs index 3efeaae43d..8a8496ecb1 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -134,7 +134,7 @@ public static SpecificVolume From(double value, SpecificVolumeUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(SpecificVolumeUnit unit) => GetValueAs(unit); + public double As(SpecificVolumeUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -142,12 +142,10 @@ public static SpecificVolume From(double value, SpecificVolumeUnit fromUnit) /// A Duration with the specified unit. public SpecificVolume ToUnit(SpecificVolumeUnit unit) { - var convertedValue = GetValueAs(unit); return new SpecificVolume(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -167,7 +165,7 @@ private double GetValueInBaseUnit() private double GetValueAs(SpecificVolumeUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificWeight.g.cs index b78e420273..576b23526a 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -291,7 +291,7 @@ public static SpecificWeight From(double value, SpecificWeightUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(SpecificWeightUnit unit) => GetValueAs(unit); + public double As(SpecificWeightUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -299,12 +299,10 @@ public static SpecificWeight From(double value, SpecificWeightUnit fromUnit) /// A Duration with the specified unit. public SpecificWeight ToUnit(SpecificWeightUnit unit) { - var convertedValue = GetValueAs(unit); return new SpecificWeight(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -338,7 +336,7 @@ private double GetValueInBaseUnit() private double GetValueAs(SpecificWeightUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Speed.g.cs index 068d009a6f..f365e0aaec 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Speed.g.cs @@ -453,7 +453,7 @@ public static Speed From(double value, SpeedUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(SpeedUnit unit) => GetValueAs(unit); + public double As(SpeedUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -461,12 +461,10 @@ public static Speed From(double value, SpeedUnit fromUnit) /// A Duration with the specified unit. public Speed ToUnit(SpeedUnit unit) { - var convertedValue = GetValueAs(unit); return new Speed(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -515,7 +513,7 @@ private double GetValueInBaseUnit() private double GetValueAs(SpeedUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/StandardVolumeFlow.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/StandardVolumeFlow.g.cs index d1382f3b60..8ad341fccd 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/StandardVolumeFlow.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/StandardVolumeFlow.g.cs @@ -200,7 +200,7 @@ public static StandardVolumeFlow From(double value, StandardVolumeFlowUnit fromU /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(StandardVolumeFlowUnit unit) => GetValueAs(unit); + public double As(StandardVolumeFlowUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -208,12 +208,10 @@ public static StandardVolumeFlow From(double value, StandardVolumeFlowUnit fromU /// A Duration with the specified unit. public StandardVolumeFlow ToUnit(StandardVolumeFlowUnit unit) { - var convertedValue = GetValueAs(unit); return new StandardVolumeFlow(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -239,7 +237,7 @@ private double GetValueInBaseUnit() private double GetValueAs(StandardVolumeFlowUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Temperature.g.cs index 8f8f51054f..6965f7db81 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Temperature.g.cs @@ -211,7 +211,7 @@ public static Temperature From(double value, TemperatureUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(TemperatureUnit unit) => GetValueAs(unit); + public double As(TemperatureUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -219,12 +219,10 @@ public static Temperature From(double value, TemperatureUnit fromUnit) /// A Duration with the specified unit. public Temperature ToUnit(TemperatureUnit unit) { - var convertedValue = GetValueAs(unit); return new Temperature(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -251,7 +249,7 @@ private double GetValueInBaseUnit() private double GetValueAs(TemperatureUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/TemperatureChangeRate.g.cs index 6d53336741..6408479051 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -211,7 +211,7 @@ public static TemperatureChangeRate From(double value, TemperatureChangeRateUnit /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(TemperatureChangeRateUnit unit) => GetValueAs(unit); + public double As(TemperatureChangeRateUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -219,12 +219,10 @@ public static TemperatureChangeRate From(double value, TemperatureChangeRateUnit /// A Duration with the specified unit. public TemperatureChangeRate ToUnit(TemperatureChangeRateUnit unit) { - var convertedValue = GetValueAs(unit); return new TemperatureChangeRate(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -251,7 +249,7 @@ private double GetValueInBaseUnit() private double GetValueAs(TemperatureChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/TemperatureDelta.g.cs index d7afb0cb62..353f0e444c 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -200,7 +200,7 @@ public static TemperatureDelta From(double value, TemperatureDeltaUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(TemperatureDeltaUnit unit) => GetValueAs(unit); + public double As(TemperatureDeltaUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -208,12 +208,10 @@ public static TemperatureDelta From(double value, TemperatureDeltaUnit fromUnit) /// A Duration with the specified unit. public TemperatureDelta ToUnit(TemperatureDeltaUnit unit) { - var convertedValue = GetValueAs(unit); return new TemperatureDelta(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -239,7 +237,7 @@ private double GetValueInBaseUnit() private double GetValueAs(TemperatureDeltaUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/TemperatureGradient.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/TemperatureGradient.g.cs index d7e669c3bd..1fe835c1ad 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/TemperatureGradient.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/TemperatureGradient.g.cs @@ -145,7 +145,7 @@ public static TemperatureGradient From(double value, TemperatureGradientUnit fro /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(TemperatureGradientUnit unit) => GetValueAs(unit); + public double As(TemperatureGradientUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -153,12 +153,10 @@ public static TemperatureGradient From(double value, TemperatureGradientUnit fro /// A Duration with the specified unit. public TemperatureGradient ToUnit(TemperatureGradientUnit unit) { - var convertedValue = GetValueAs(unit); return new TemperatureGradient(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -179,7 +177,7 @@ private double GetValueInBaseUnit() private double GetValueAs(TemperatureGradientUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ThermalConductivity.g.cs index 15929a67a0..d1a1cc6657 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ThermalConductivity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ThermalConductivity.g.cs @@ -126,7 +126,7 @@ public static ThermalConductivity From(double value, ThermalConductivityUnit fro /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ThermalConductivityUnit unit) => GetValueAs(unit); + public double As(ThermalConductivityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -134,12 +134,10 @@ public static ThermalConductivity From(double value, ThermalConductivityUnit fro /// A Duration with the specified unit. public ThermalConductivity ToUnit(ThermalConductivityUnit unit) { - var convertedValue = GetValueAs(unit); return new ThermalConductivity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -158,7 +156,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ThermalConductivityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ThermalResistance.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ThermalResistance.g.cs index 9758a089af..2355680fb8 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/ThermalResistance.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/ThermalResistance.g.cs @@ -167,7 +167,7 @@ public static ThermalResistance From(double value, ThermalResistanceUnit fromUni /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(ThermalResistanceUnit unit) => GetValueAs(unit); + public double As(ThermalResistanceUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -175,12 +175,10 @@ public static ThermalResistance From(double value, ThermalResistanceUnit fromUni /// A Duration with the specified unit. public ThermalResistance ToUnit(ThermalResistanceUnit unit) { - var convertedValue = GetValueAs(unit); return new ThermalResistance(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -203,7 +201,7 @@ private double GetValueInBaseUnit() private double GetValueAs(ThermalResistanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Torque.g.cs index 1241551811..790bfb90c5 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Torque.g.cs @@ -376,7 +376,7 @@ public static Torque From(double value, TorqueUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(TorqueUnit unit) => GetValueAs(unit); + public double As(TorqueUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -384,12 +384,10 @@ public static Torque From(double value, TorqueUnit fromUnit) /// A Duration with the specified unit. public Torque ToUnit(TorqueUnit unit) { - var convertedValue = GetValueAs(unit); return new Torque(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -431,7 +429,7 @@ private double GetValueInBaseUnit() private double GetValueAs(TorqueUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/TorquePerLength.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/TorquePerLength.g.cs index 5c095bb043..2f227ac16b 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/TorquePerLength.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/TorquePerLength.g.cs @@ -332,7 +332,7 @@ public static TorquePerLength From(double value, TorquePerLengthUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(TorquePerLengthUnit unit) => GetValueAs(unit); + public double As(TorquePerLengthUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -340,12 +340,10 @@ public static TorquePerLength From(double value, TorquePerLengthUnit fromUnit) /// A Duration with the specified unit. public TorquePerLength ToUnit(TorquePerLengthUnit unit) { - var convertedValue = GetValueAs(unit); return new TorquePerLength(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -383,7 +381,7 @@ private double GetValueInBaseUnit() private double GetValueAs(TorquePerLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Turbidity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Turbidity.g.cs index 0af65166a0..b11dc3345b 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Turbidity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Turbidity.g.cs @@ -115,7 +115,7 @@ public static Turbidity From(double value, TurbidityUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(TurbidityUnit unit) => GetValueAs(unit); + public double As(TurbidityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -123,12 +123,10 @@ public static Turbidity From(double value, TurbidityUnit fromUnit) /// A Duration with the specified unit. public Turbidity ToUnit(TurbidityUnit unit) { - var convertedValue = GetValueAs(unit); return new Turbidity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -146,7 +144,7 @@ private double GetValueInBaseUnit() private double GetValueAs(TurbidityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VitaminA.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VitaminA.g.cs index ee3e993dce..6f4792b5da 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VitaminA.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VitaminA.g.cs @@ -112,7 +112,7 @@ public static VitaminA From(double value, VitaminAUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(VitaminAUnit unit) => GetValueAs(unit); + public double As(VitaminAUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -120,12 +120,10 @@ public static VitaminA From(double value, VitaminAUnit fromUnit) /// A Duration with the specified unit. public VitaminA ToUnit(VitaminAUnit unit) { - var convertedValue = GetValueAs(unit); return new VitaminA(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -143,7 +141,7 @@ private double GetValueInBaseUnit() private double GetValueAs(VitaminAUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Volume.g.cs index ddd7007bfc..b042b8761e 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Volume.g.cs @@ -662,7 +662,7 @@ public static Volume From(double value, VolumeUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(VolumeUnit unit) => GetValueAs(unit); + public double As(VolumeUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -670,12 +670,10 @@ public static Volume From(double value, VolumeUnit fromUnit) /// A Duration with the specified unit. public Volume ToUnit(VolumeUnit unit) { - var convertedValue = GetValueAs(unit); return new Volume(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -743,7 +741,7 @@ private double GetValueInBaseUnit() private double GetValueAs(VolumeUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeConcentration.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeConcentration.g.cs index 84f16f4580..d1db57d7f3 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeConcentration.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeConcentration.g.cs @@ -324,7 +324,7 @@ public static VolumeConcentration From(double value, VolumeConcentrationUnit fro /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(VolumeConcentrationUnit unit) => GetValueAs(unit); + public double As(VolumeConcentrationUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -332,12 +332,10 @@ public static VolumeConcentration From(double value, VolumeConcentrationUnit fro /// A Duration with the specified unit. public VolumeConcentration ToUnit(VolumeConcentrationUnit unit) { - var convertedValue = GetValueAs(unit); return new VolumeConcentration(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -374,7 +372,7 @@ private double GetValueInBaseUnit() private double GetValueAs(VolumeConcentrationUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeFlow.g.cs index 60530c5fb6..95376fd281 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -783,7 +783,7 @@ public static VolumeFlow From(double value, VolumeFlowUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(VolumeFlowUnit unit) => GetValueAs(unit); + public double As(VolumeFlowUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -791,12 +791,10 @@ public static VolumeFlow From(double value, VolumeFlowUnit fromUnit) /// A Duration with the specified unit. public VolumeFlow ToUnit(VolumeFlowUnit unit) { - var convertedValue = GetValueAs(unit); return new VolumeFlow(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -875,7 +873,7 @@ private double GetValueInBaseUnit() private double GetValueAs(VolumeFlowUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs index 0ca23a6a9b..a34549e24d 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs @@ -123,7 +123,7 @@ public static VolumeFlowPerArea From(double value, VolumeFlowPerAreaUnit fromUni /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(VolumeFlowPerAreaUnit unit) => GetValueAs(unit); + public double As(VolumeFlowPerAreaUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -131,12 +131,10 @@ public static VolumeFlowPerArea From(double value, VolumeFlowPerAreaUnit fromUni /// A Duration with the specified unit. public VolumeFlowPerArea ToUnit(VolumeFlowPerAreaUnit unit) { - var convertedValue = GetValueAs(unit); return new VolumeFlowPerArea(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -155,7 +153,7 @@ private double GetValueInBaseUnit() private double GetValueAs(VolumeFlowPerAreaUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumePerLength.g.cs index 0c3a42ee6a..48dc3d78bd 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -178,7 +178,7 @@ public static VolumePerLength From(double value, VolumePerLengthUnit fromUnit) /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(VolumePerLengthUnit unit) => GetValueAs(unit); + public double As(VolumePerLengthUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -186,12 +186,10 @@ public static VolumePerLength From(double value, VolumePerLengthUnit fromUnit) /// A Duration with the specified unit. public VolumePerLength ToUnit(VolumePerLengthUnit unit) { - var convertedValue = GetValueAs(unit); return new VolumePerLength(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -215,7 +213,7 @@ private double GetValueInBaseUnit() private double GetValueAs(VolumePerLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs index b43908c014..cb07e294f6 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs @@ -203,7 +203,7 @@ public static VolumetricHeatCapacity From(double value, VolumetricHeatCapacityUn /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(VolumetricHeatCapacityUnit unit) => GetValueAs(unit); + public double As(VolumetricHeatCapacityUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -211,12 +211,10 @@ public static VolumetricHeatCapacity From(double value, VolumetricHeatCapacityUn /// A Duration with the specified unit. public VolumetricHeatCapacity ToUnit(VolumetricHeatCapacityUnit unit) { - var convertedValue = GetValueAs(unit); return new VolumetricHeatCapacity(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -242,7 +240,7 @@ private double GetValueInBaseUnit() private double GetValueAs(VolumetricHeatCapacityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs index f3ede9fd35..942eda081c 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs @@ -167,7 +167,7 @@ public static WarpingMomentOfInertia From(double value, WarpingMomentOfInertiaUn /// Convert to the unit representation . /// /// Value converted to the specified unit. - public double As(WarpingMomentOfInertiaUnit unit) => GetValueAs(unit); + public double As(WarpingMomentOfInertiaUnit unit) => GetValueAs(unit); /// /// Converts this Duration to another Duration with the unit representation . @@ -175,12 +175,10 @@ public static WarpingMomentOfInertia From(double value, WarpingMomentOfInertiaUn /// A Duration with the specified unit. public WarpingMomentOfInertia ToUnit(WarpingMomentOfInertiaUnit unit) { - var convertedValue = GetValueAs(unit); return new WarpingMomentOfInertia(convertedValue, unit); } - /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. @@ -203,7 +201,7 @@ private double GetValueInBaseUnit() private double GetValueAs(WarpingMomentOfInertiaUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = GetValueInBaseUnit(); diff --git a/UnitsNet.Tests/AssertEx.cs b/UnitsNet.Tests/AssertEx.cs index cf90732786..d052adfeec 100644 --- a/UnitsNet.Tests/AssertEx.cs +++ b/UnitsNet.Tests/AssertEx.cs @@ -10,7 +10,7 @@ public static class AssertEx { public static void EqualTolerance(double expected, double actual, double tolerance, ComparisonType comparisonType = ComparisonType.Relative) { - if(comparisonType == ComparisonType.Relative) + if (comparisonType == ComparisonType.Relative) { bool areEqual = Comparison.EqualsRelative(expected, actual, tolerance); @@ -19,7 +19,7 @@ public static void EqualTolerance(double expected, double actual, double toleran Assert.True( areEqual, $"Values are not equal within relative tolerance: {tolerance:P4}\nExpected: {expected}\nActual: {actual}\nDiff: {relativeDifference:P4}" ); } - else if( comparisonType == ComparisonType.Absolute ) + else if (comparisonType == ComparisonType.Absolute) { bool areEqual = Comparison.EqualsAbsolute(expected, actual, tolerance); Assert.True( areEqual, $"Values are not equal within absolute tolerance: {tolerance}\nExpected: {expected}\nActual: {actual}\nDiff: {actual - expected:e}" ); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs index 13abeeccbc..736a45eb31 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs @@ -338,7 +338,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(AccelerationUnit var fromUnit = Acceleration.Units.FirstOrDefault(u => u != Acceleration.BaseUnit && u != AccelerationUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == AccelerationUnit.Undefined) + if (fromUnit == AccelerationUnit.Undefined) fromUnit = Acceleration.BaseUnit; var quantity = Acceleration.From(3.0, fromUnit); @@ -503,7 +503,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(AccelerationUnit)).Cast(); foreach(var unit in units) { - if(unit == AccelerationUnit.Undefined) + if (unit == AccelerationUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs index 01cd7be916..f4a7d3e3ca 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs @@ -348,7 +348,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(AmountOfSubstanc var fromUnit = AmountOfSubstance.Units.FirstOrDefault(u => u != AmountOfSubstance.BaseUnit && u != AmountOfSubstanceUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == AmountOfSubstanceUnit.Undefined) + if (fromUnit == AmountOfSubstanceUnit.Undefined) fromUnit = AmountOfSubstance.BaseUnit; var quantity = AmountOfSubstance.From(3.0, fromUnit); @@ -514,7 +514,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(AmountOfSubstanceUnit)).Cast(); foreach(var unit in units) { - if(unit == AmountOfSubstanceUnit.Undefined) + if (unit == AmountOfSubstanceUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs index eb9a8dc24f..829e0ead8b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs @@ -238,7 +238,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(AmplitudeRatioUn var fromUnit = AmplitudeRatio.Units.FirstOrDefault(u => u != AmplitudeRatio.BaseUnit && u != AmplitudeRatioUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == AmplitudeRatioUnit.Undefined) + if (fromUnit == AmplitudeRatioUnit.Undefined) fromUnit = AmplitudeRatio.BaseUnit; var quantity = AmplitudeRatio.From(3.0, fromUnit); @@ -397,7 +397,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(AmplitudeRatioUnit)).Cast(); foreach(var unit in units) { - if(unit == AmplitudeRatioUnit.Undefined) + if (unit == AmplitudeRatioUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs index bfecc91bbc..e7769748ad 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs @@ -358,7 +358,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(AngleUnit unit) var fromUnit = Angle.Units.FirstOrDefault(u => u != Angle.BaseUnit && u != AngleUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == AngleUnit.Undefined) + if (fromUnit == AngleUnit.Undefined) fromUnit = Angle.BaseUnit; var quantity = Angle.From(3.0, fromUnit); @@ -525,7 +525,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(AngleUnit)).Cast(); foreach(var unit in units) { - if(unit == AngleUnit.Undefined) + if (unit == AngleUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs index 3731afa216..618e4a13b1 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs @@ -228,7 +228,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ApparentEnergyUn var fromUnit = ApparentEnergy.Units.FirstOrDefault(u => u != ApparentEnergy.BaseUnit && u != ApparentEnergyUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ApparentEnergyUnit.Undefined) + if (fromUnit == ApparentEnergyUnit.Undefined) fromUnit = ApparentEnergy.BaseUnit; var quantity = ApparentEnergy.From(3.0, fromUnit); @@ -382,7 +382,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ApparentEnergyUnit)).Cast(); foreach(var unit in units) { - if(unit == ApparentEnergyUnit.Undefined) + if (unit == ApparentEnergyUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs index aa5184f730..e91315d73f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs @@ -238,7 +238,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ApparentPowerUni var fromUnit = ApparentPower.Units.FirstOrDefault(u => u != ApparentPower.BaseUnit && u != ApparentPowerUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ApparentPowerUnit.Undefined) + if (fromUnit == ApparentPowerUnit.Undefined) fromUnit = ApparentPower.BaseUnit; var quantity = ApparentPower.From(3.0, fromUnit); @@ -393,7 +393,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ApparentPowerUnit)).Cast(); foreach(var unit in units) { - if(unit == ApparentPowerUnit.Undefined) + if (unit == ApparentPowerUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs index 1d8d35a570..1dc896e900 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs @@ -208,7 +208,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(AreaDensityUnit var fromUnit = AreaDensity.Units.FirstOrDefault(u => u != AreaDensity.BaseUnit && u != AreaDensityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == AreaDensityUnit.Undefined) + if (fromUnit == AreaDensityUnit.Undefined) fromUnit = AreaDensity.BaseUnit; var quantity = AreaDensity.From(3.0, fromUnit); @@ -360,7 +360,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(AreaDensityUnit)).Cast(); foreach(var unit in units) { - if(unit == AreaDensityUnit.Undefined) + if (unit == AreaDensityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs index 835911e9a6..a1e001f9d7 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs @@ -258,7 +258,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(AreaMomentOfIner var fromUnit = AreaMomentOfInertia.Units.FirstOrDefault(u => u != AreaMomentOfInertia.BaseUnit && u != AreaMomentOfInertiaUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == AreaMomentOfInertiaUnit.Undefined) + if (fromUnit == AreaMomentOfInertiaUnit.Undefined) fromUnit = AreaMomentOfInertia.BaseUnit; var quantity = AreaMomentOfInertia.From(3.0, fromUnit); @@ -415,7 +415,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(AreaMomentOfInertiaUnit)).Cast(); foreach(var unit in units) { - if(unit == AreaMomentOfInertiaUnit.Undefined) + if (unit == AreaMomentOfInertiaUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs index d77e8fbd30..054c9aa14b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs @@ -338,7 +338,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(AreaUnit unit) var fromUnit = Area.Units.FirstOrDefault(u => u != Area.BaseUnit && u != AreaUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == AreaUnit.Undefined) + if (fromUnit == AreaUnit.Undefined) fromUnit = Area.BaseUnit; var quantity = Area.From(3.0, fromUnit); @@ -503,7 +503,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(AreaUnit)).Cast(); foreach(var unit in units) { - if(unit == AreaUnit.Undefined) + if (unit == AreaUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs index 7b0d1ce275..dd09f8ff91 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs @@ -433,7 +433,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(BitRateUnit unit var fromUnit = BitRate.Units.FirstOrDefault(u => u != BitRate.BaseUnit && u != BitRateUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == BitRateUnit.Undefined) + if (fromUnit == BitRateUnit.Undefined) fromUnit = BitRate.BaseUnit; var quantity = BitRate.From(3.0, fromUnit); @@ -610,7 +610,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(BitRateUnit)).Cast(); foreach(var unit in units) { - if(unit == BitRateUnit.Undefined) + if (unit == BitRateUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs index cdbd7f043f..8ca94add2b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs @@ -228,7 +228,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(BrakeSpecificFue var fromUnit = BrakeSpecificFuelConsumption.Units.FirstOrDefault(u => u != BrakeSpecificFuelConsumption.BaseUnit && u != BrakeSpecificFuelConsumptionUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == BrakeSpecificFuelConsumptionUnit.Undefined) + if (fromUnit == BrakeSpecificFuelConsumptionUnit.Undefined) fromUnit = BrakeSpecificFuelConsumption.BaseUnit; var quantity = BrakeSpecificFuelConsumption.From(3.0, fromUnit); @@ -382,7 +382,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(BrakeSpecificFuelConsumptionUnit)).Cast(); foreach(var unit in units) { - if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) + if (unit == BrakeSpecificFuelConsumptionUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs index d6dc3c5031..03ee257116 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs @@ -268,7 +268,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(CapacitanceUnit var fromUnit = Capacitance.Units.FirstOrDefault(u => u != Capacitance.BaseUnit && u != CapacitanceUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == CapacitanceUnit.Undefined) + if (fromUnit == CapacitanceUnit.Undefined) fromUnit = Capacitance.BaseUnit; var quantity = Capacitance.From(3.0, fromUnit); @@ -426,7 +426,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(CapacitanceUnit)).Cast(); foreach(var unit in units) { - if(unit == CapacitanceUnit.Undefined) + if (unit == CapacitanceUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs index b0ac487406..12c4d42141 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs @@ -228,7 +228,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(CoefficientOfThe var fromUnit = CoefficientOfThermalExpansion.Units.FirstOrDefault(u => u != CoefficientOfThermalExpansion.BaseUnit && u != CoefficientOfThermalExpansionUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == CoefficientOfThermalExpansionUnit.Undefined) + if (fromUnit == CoefficientOfThermalExpansionUnit.Undefined) fromUnit = CoefficientOfThermalExpansion.BaseUnit; var quantity = CoefficientOfThermalExpansion.From(3.0, fromUnit); @@ -382,7 +382,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(CoefficientOfThermalExpansionUnit)).Cast(); foreach(var unit in units) { - if(unit == CoefficientOfThermalExpansionUnit.Undefined) + if (unit == CoefficientOfThermalExpansionUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs index c7643f3540..240a59a5ba 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs @@ -708,7 +708,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(DensityUnit unit var fromUnit = Density.Units.FirstOrDefault(u => u != Density.BaseUnit && u != DensityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == DensityUnit.Undefined) + if (fromUnit == DensityUnit.Undefined) fromUnit = Density.BaseUnit; var quantity = Density.From(3.0, fromUnit); @@ -910,7 +910,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(DensityUnit)).Cast(); foreach(var unit in units) { - if(unit == DensityUnit.Undefined) + if (unit == DensityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs index bb1ca8753d..c995df76e2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs @@ -308,7 +308,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(DurationUnit uni var fromUnit = Duration.Units.FirstOrDefault(u => u != Duration.BaseUnit && u != DurationUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == DurationUnit.Undefined) + if (fromUnit == DurationUnit.Undefined) fromUnit = Duration.BaseUnit; var quantity = Duration.From(3.0, fromUnit); @@ -470,7 +470,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(DurationUnit)).Cast(); foreach(var unit in units) { - if(unit == DurationUnit.Undefined) + if (unit == DurationUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs index 743e6be92f..5535166340 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs @@ -298,7 +298,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(DynamicViscosity var fromUnit = DynamicViscosity.Units.FirstOrDefault(u => u != DynamicViscosity.BaseUnit && u != DynamicViscosityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == DynamicViscosityUnit.Undefined) + if (fromUnit == DynamicViscosityUnit.Undefined) fromUnit = DynamicViscosity.BaseUnit; var quantity = DynamicViscosity.From(3.0, fromUnit); @@ -459,7 +459,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(DynamicViscosityUnit)).Cast(); foreach(var unit in units) { - if(unit == DynamicViscosityUnit.Undefined) + if (unit == DynamicViscosityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs index b4c6557bde..ee683808a6 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs @@ -238,7 +238,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricAdmittan var fromUnit = ElectricAdmittance.Units.FirstOrDefault(u => u != ElectricAdmittance.BaseUnit && u != ElectricAdmittanceUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricAdmittanceUnit.Undefined) + if (fromUnit == ElectricAdmittanceUnit.Undefined) fromUnit = ElectricAdmittance.BaseUnit; var quantity = ElectricAdmittance.From(3.0, fromUnit); @@ -393,7 +393,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricAdmittanceUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricAdmittanceUnit.Undefined) + if (unit == ElectricAdmittanceUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs index 17e05c7b60..cfaf66c34f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs @@ -208,7 +208,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricChargeDe var fromUnit = ElectricChargeDensity.Units.FirstOrDefault(u => u != ElectricChargeDensity.BaseUnit && u != ElectricChargeDensityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricChargeDensityUnit.Undefined) + if (fromUnit == ElectricChargeDensityUnit.Undefined) fromUnit = ElectricChargeDensity.BaseUnit; var quantity = ElectricChargeDensity.From(3.0, fromUnit); @@ -360,7 +360,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricChargeDensityUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricChargeDensityUnit.Undefined) + if (unit == ElectricChargeDensityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs index 7fefdc564b..9f53f5e9df 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs @@ -248,7 +248,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricChargeUn var fromUnit = ElectricCharge.Units.FirstOrDefault(u => u != ElectricCharge.BaseUnit && u != ElectricChargeUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricChargeUnit.Undefined) + if (fromUnit == ElectricChargeUnit.Undefined) fromUnit = ElectricCharge.BaseUnit; var quantity = ElectricCharge.From(3.0, fromUnit); @@ -404,7 +404,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricChargeUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricChargeUnit.Undefined) + if (unit == ElectricChargeUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs index 1e4cd156e5..2962a6f6e0 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs @@ -228,7 +228,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricConducta var fromUnit = ElectricConductance.Units.FirstOrDefault(u => u != ElectricConductance.BaseUnit && u != ElectricConductanceUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricConductanceUnit.Undefined) + if (fromUnit == ElectricConductanceUnit.Undefined) fromUnit = ElectricConductance.BaseUnit; var quantity = ElectricConductance.From(3.0, fromUnit); @@ -382,7 +382,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricConductanceUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricConductanceUnit.Undefined) + if (unit == ElectricConductanceUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs index 55a741771f..4345dd8f69 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs @@ -228,7 +228,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricConducti var fromUnit = ElectricConductivity.Units.FirstOrDefault(u => u != ElectricConductivity.BaseUnit && u != ElectricConductivityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricConductivityUnit.Undefined) + if (fromUnit == ElectricConductivityUnit.Undefined) fromUnit = ElectricConductivity.BaseUnit; var quantity = ElectricConductivity.From(3.0, fromUnit); @@ -382,7 +382,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricConductivityUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricConductivityUnit.Undefined) + if (unit == ElectricConductivityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs index e3c7067ce5..acafb84845 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs @@ -228,7 +228,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricCurrentD var fromUnit = ElectricCurrentDensity.Units.FirstOrDefault(u => u != ElectricCurrentDensity.BaseUnit && u != ElectricCurrentDensityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricCurrentDensityUnit.Undefined) + if (fromUnit == ElectricCurrentDensityUnit.Undefined) fromUnit = ElectricCurrentDensity.BaseUnit; var quantity = ElectricCurrentDensity.From(3.0, fromUnit); @@ -382,7 +382,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricCurrentDensityUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricCurrentDensityUnit.Undefined) + if (unit == ElectricCurrentDensityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs index 9663d96458..289e5417f5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs @@ -238,7 +238,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricCurrentG var fromUnit = ElectricCurrentGradient.Units.FirstOrDefault(u => u != ElectricCurrentGradient.BaseUnit && u != ElectricCurrentGradientUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricCurrentGradientUnit.Undefined) + if (fromUnit == ElectricCurrentGradientUnit.Undefined) fromUnit = ElectricCurrentGradient.BaseUnit; var quantity = ElectricCurrentGradient.From(3.0, fromUnit); @@ -393,7 +393,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricCurrentGradientUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricCurrentGradientUnit.Undefined) + if (unit == ElectricCurrentGradientUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs index 3374cd2321..02b9ce307d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs @@ -278,7 +278,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricCurrentU var fromUnit = ElectricCurrent.Units.FirstOrDefault(u => u != ElectricCurrent.BaseUnit && u != ElectricCurrentUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricCurrentUnit.Undefined) + if (fromUnit == ElectricCurrentUnit.Undefined) fromUnit = ElectricCurrent.BaseUnit; var quantity = ElectricCurrent.From(3.0, fromUnit); @@ -437,7 +437,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricCurrentUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricCurrentUnit.Undefined) + if (unit == ElectricCurrentUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs index 825ea88e65..2e32e8c4fa 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs @@ -208,7 +208,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricFieldUni var fromUnit = ElectricField.Units.FirstOrDefault(u => u != ElectricField.BaseUnit && u != ElectricFieldUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricFieldUnit.Undefined) + if (fromUnit == ElectricFieldUnit.Undefined) fromUnit = ElectricField.BaseUnit; var quantity = ElectricField.From(3.0, fromUnit); @@ -360,7 +360,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricFieldUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricFieldUnit.Undefined) + if (unit == ElectricFieldUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs index 8c7f0f8f83..ed681fdb09 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs @@ -238,7 +238,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricInductan var fromUnit = ElectricInductance.Units.FirstOrDefault(u => u != ElectricInductance.BaseUnit && u != ElectricInductanceUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricInductanceUnit.Undefined) + if (fromUnit == ElectricInductanceUnit.Undefined) fromUnit = ElectricInductance.BaseUnit; var quantity = ElectricInductance.From(3.0, fromUnit); @@ -393,7 +393,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricInductanceUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricInductanceUnit.Undefined) + if (unit == ElectricInductanceUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs index dc62cb8d5d..895d7439e6 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs @@ -248,7 +248,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricPotentia var fromUnit = ElectricPotentialAc.Units.FirstOrDefault(u => u != ElectricPotentialAc.BaseUnit && u != ElectricPotentialAcUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricPotentialAcUnit.Undefined) + if (fromUnit == ElectricPotentialAcUnit.Undefined) fromUnit = ElectricPotentialAc.BaseUnit; var quantity = ElectricPotentialAc.From(3.0, fromUnit); @@ -404,7 +404,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricPotentialAcUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricPotentialAcUnit.Undefined) + if (unit == ElectricPotentialAcUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs index 6cbe276aab..c0bf9a065c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs @@ -398,7 +398,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricPotentia var fromUnit = ElectricPotentialChangeRate.Units.FirstOrDefault(u => u != ElectricPotentialChangeRate.BaseUnit && u != ElectricPotentialChangeRateUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricPotentialChangeRateUnit.Undefined) + if (fromUnit == ElectricPotentialChangeRateUnit.Undefined) fromUnit = ElectricPotentialChangeRate.BaseUnit; var quantity = ElectricPotentialChangeRate.From(3.0, fromUnit); @@ -569,7 +569,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricPotentialChangeRateUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricPotentialChangeRateUnit.Undefined) + if (unit == ElectricPotentialChangeRateUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs index df1cfbd31f..0afb0ddce5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs @@ -248,7 +248,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricPotentia var fromUnit = ElectricPotentialDc.Units.FirstOrDefault(u => u != ElectricPotentialDc.BaseUnit && u != ElectricPotentialDcUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricPotentialDcUnit.Undefined) + if (fromUnit == ElectricPotentialDcUnit.Undefined) fromUnit = ElectricPotentialDc.BaseUnit; var quantity = ElectricPotentialDc.From(3.0, fromUnit); @@ -404,7 +404,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricPotentialDcUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricPotentialDcUnit.Undefined) + if (unit == ElectricPotentialDcUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs index 89742b883c..827327f35c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs @@ -248,7 +248,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricPotentia var fromUnit = ElectricPotential.Units.FirstOrDefault(u => u != ElectricPotential.BaseUnit && u != ElectricPotentialUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricPotentialUnit.Undefined) + if (fromUnit == ElectricPotentialUnit.Undefined) fromUnit = ElectricPotential.BaseUnit; var quantity = ElectricPotential.From(3.0, fromUnit); @@ -404,7 +404,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricPotentialUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricPotentialUnit.Undefined) + if (unit == ElectricPotentialUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs index fedf7e6908..1e4c77ce28 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs @@ -258,7 +258,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricResistan var fromUnit = ElectricResistance.Units.FirstOrDefault(u => u != ElectricResistance.BaseUnit && u != ElectricResistanceUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricResistanceUnit.Undefined) + if (fromUnit == ElectricResistanceUnit.Undefined) fromUnit = ElectricResistance.BaseUnit; var quantity = ElectricResistance.From(3.0, fromUnit); @@ -415,7 +415,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricResistanceUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricResistanceUnit.Undefined) + if (unit == ElectricResistanceUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs index 3c9463fa71..2c44c075ab 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs @@ -338,7 +338,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricResistiv var fromUnit = ElectricResistivity.Units.FirstOrDefault(u => u != ElectricResistivity.BaseUnit && u != ElectricResistivityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricResistivityUnit.Undefined) + if (fromUnit == ElectricResistivityUnit.Undefined) fromUnit = ElectricResistivity.BaseUnit; var quantity = ElectricResistivity.From(3.0, fromUnit); @@ -503,7 +503,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricResistivityUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricResistivityUnit.Undefined) + if (unit == ElectricResistivityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs index baf69ed89a..d84f06e3fd 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs @@ -228,7 +228,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ElectricSurfaceC var fromUnit = ElectricSurfaceChargeDensity.Units.FirstOrDefault(u => u != ElectricSurfaceChargeDensity.BaseUnit && u != ElectricSurfaceChargeDensityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ElectricSurfaceChargeDensityUnit.Undefined) + if (fromUnit == ElectricSurfaceChargeDensityUnit.Undefined) fromUnit = ElectricSurfaceChargeDensity.BaseUnit; var quantity = ElectricSurfaceChargeDensity.From(3.0, fromUnit); @@ -382,7 +382,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ElectricSurfaceChargeDensityUnit)).Cast(); foreach(var unit in units) { - if(unit == ElectricSurfaceChargeDensityUnit.Undefined) + if (unit == ElectricSurfaceChargeDensityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs index 4f31580566..f58d3cdaad 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs @@ -558,7 +558,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(EnergyUnit unit) var fromUnit = Energy.Units.FirstOrDefault(u => u != Energy.BaseUnit && u != EnergyUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == EnergyUnit.Undefined) + if (fromUnit == EnergyUnit.Undefined) fromUnit = Energy.BaseUnit; var quantity = Energy.From(3.0, fromUnit); @@ -745,7 +745,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(EnergyUnit)).Cast(); foreach(var unit in units) { - if(unit == EnergyUnit.Undefined) + if (unit == EnergyUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs index 55859a487e..90bc1e0eaa 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs @@ -268,7 +268,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(EntropyUnit unit var fromUnit = Entropy.Units.FirstOrDefault(u => u != Entropy.BaseUnit && u != EntropyUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == EntropyUnit.Undefined) + if (fromUnit == EntropyUnit.Undefined) fromUnit = Entropy.BaseUnit; var quantity = Entropy.From(3.0, fromUnit); @@ -426,7 +426,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(EntropyUnit)).Cast(); foreach(var unit in units) { - if(unit == EntropyUnit.Undefined) + if (unit == EntropyUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs index fe9203fc90..d4e41d0f6a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs @@ -348,7 +348,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ForceChangeRateU var fromUnit = ForceChangeRate.Units.FirstOrDefault(u => u != ForceChangeRate.BaseUnit && u != ForceChangeRateUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ForceChangeRateUnit.Undefined) + if (fromUnit == ForceChangeRateUnit.Undefined) fromUnit = ForceChangeRate.BaseUnit; var quantity = ForceChangeRate.From(3.0, fromUnit); @@ -514,7 +514,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ForceChangeRateUnit)).Cast(); foreach(var unit in units) { - if(unit == ForceChangeRateUnit.Undefined) + if (unit == ForceChangeRateUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs index 7ddeacc15a..69586518d9 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs @@ -578,7 +578,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ForcePerLengthUn var fromUnit = ForcePerLength.Units.FirstOrDefault(u => u != ForcePerLength.BaseUnit && u != ForcePerLengthUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ForcePerLengthUnit.Undefined) + if (fromUnit == ForcePerLengthUnit.Undefined) fromUnit = ForcePerLength.BaseUnit; var quantity = ForcePerLength.From(3.0, fromUnit); @@ -767,7 +767,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ForcePerLengthUnit)).Cast(); foreach(var unit in units) { - if(unit == ForcePerLengthUnit.Undefined) + if (unit == ForcePerLengthUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs index 38541fa42f..e109b88c8e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs @@ -348,7 +348,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ForceUnit unit) var fromUnit = Force.Units.FirstOrDefault(u => u != Force.BaseUnit && u != ForceUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ForceUnit.Undefined) + if (fromUnit == ForceUnit.Undefined) fromUnit = Force.BaseUnit; var quantity = Force.From(3.0, fromUnit); @@ -514,7 +514,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ForceUnit)).Cast(); foreach(var unit in units) { - if(unit == ForceUnit.Undefined) + if (unit == ForceUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs index b98ac9dc61..9eda5ce8e2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs @@ -308,7 +308,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(FrequencyUnit un var fromUnit = Frequency.Units.FirstOrDefault(u => u != Frequency.BaseUnit && u != FrequencyUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == FrequencyUnit.Undefined) + if (fromUnit == FrequencyUnit.Undefined) fromUnit = Frequency.BaseUnit; var quantity = Frequency.From(3.0, fromUnit); @@ -470,7 +470,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(FrequencyUnit)).Cast(); foreach(var unit in units) { - if(unit == FrequencyUnit.Undefined) + if (unit == FrequencyUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs index 3cb1885b6f..51275b3fc2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs @@ -238,7 +238,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(FuelEfficiencyUn var fromUnit = FuelEfficiency.Units.FirstOrDefault(u => u != FuelEfficiency.BaseUnit && u != FuelEfficiencyUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == FuelEfficiencyUnit.Undefined) + if (fromUnit == FuelEfficiencyUnit.Undefined) fromUnit = FuelEfficiency.BaseUnit; var quantity = FuelEfficiency.From(3.0, fromUnit); @@ -393,7 +393,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(FuelEfficiencyUnit)).Cast(); foreach(var unit in units) { - if(unit == FuelEfficiencyUnit.Undefined) + if (unit == FuelEfficiencyUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs index 327cc30781..5e1c3a93bf 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs @@ -378,7 +378,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(HeatFluxUnit uni var fromUnit = HeatFlux.Units.FirstOrDefault(u => u != HeatFlux.BaseUnit && u != HeatFluxUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == HeatFluxUnit.Undefined) + if (fromUnit == HeatFluxUnit.Undefined) fromUnit = HeatFlux.BaseUnit; var quantity = HeatFlux.From(3.0, fromUnit); @@ -547,7 +547,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(HeatFluxUnit)).Cast(); foreach(var unit in units) { - if(unit == HeatFluxUnit.Undefined) + if (unit == HeatFluxUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs index 5688e459b1..6656837d7d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs @@ -228,7 +228,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(HeatTransferCoef var fromUnit = HeatTransferCoefficient.Units.FirstOrDefault(u => u != HeatTransferCoefficient.BaseUnit && u != HeatTransferCoefficientUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == HeatTransferCoefficientUnit.Undefined) + if (fromUnit == HeatTransferCoefficientUnit.Undefined) fromUnit = HeatTransferCoefficient.BaseUnit; var quantity = HeatTransferCoefficient.From(3.0, fromUnit); @@ -382,7 +382,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(HeatTransferCoefficientUnit)).Cast(); foreach(var unit in units) { - if(unit == HeatTransferCoefficientUnit.Undefined) + if (unit == HeatTransferCoefficientUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs index 5dad5be5cd..2a0b4f50fa 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs @@ -238,7 +238,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(IlluminanceUnit var fromUnit = Illuminance.Units.FirstOrDefault(u => u != Illuminance.BaseUnit && u != IlluminanceUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == IlluminanceUnit.Undefined) + if (fromUnit == IlluminanceUnit.Undefined) fromUnit = Illuminance.BaseUnit; var quantity = Illuminance.From(3.0, fromUnit); @@ -393,7 +393,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(IlluminanceUnit)).Cast(); foreach(var unit in units) { - if(unit == IlluminanceUnit.Undefined) + if (unit == IlluminanceUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs index d42510c69f..2bc5ec36d2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs @@ -433,7 +433,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(InformationUnit var fromUnit = Information.Units.FirstOrDefault(u => u != Information.BaseUnit && u != InformationUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == InformationUnit.Undefined) + if (fromUnit == InformationUnit.Undefined) fromUnit = Information.BaseUnit; var quantity = Information.From(3.0, fromUnit); @@ -610,7 +610,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(InformationUnit)).Cast(); foreach(var unit in units) { - if(unit == InformationUnit.Undefined) + if (unit == InformationUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs index 6e6f49a82a..828d7e3869 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs @@ -338,7 +338,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(IrradianceUnit u var fromUnit = Irradiance.Units.FirstOrDefault(u => u != Irradiance.BaseUnit && u != IrradianceUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == IrradianceUnit.Undefined) + if (fromUnit == IrradianceUnit.Undefined) fromUnit = Irradiance.BaseUnit; var quantity = Irradiance.From(3.0, fromUnit); @@ -503,7 +503,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(IrradianceUnit)).Cast(); foreach(var unit in units) { - if(unit == IrradianceUnit.Undefined) + if (unit == IrradianceUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs index 1fa8cb53cd..33a71b1b05 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs @@ -268,7 +268,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(IrradiationUnit var fromUnit = Irradiation.Units.FirstOrDefault(u => u != Irradiation.BaseUnit && u != IrradiationUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == IrradiationUnit.Undefined) + if (fromUnit == IrradiationUnit.Undefined) fromUnit = Irradiation.BaseUnit; var quantity = Irradiation.From(3.0, fromUnit); @@ -426,7 +426,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(IrradiationUnit)).Cast(); foreach(var unit in units) { - if(unit == IrradiationUnit.Undefined) + if (unit == IrradiationUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs index 75b9a0be85..7861a5a2e2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs @@ -288,7 +288,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(KinematicViscosi var fromUnit = KinematicViscosity.Units.FirstOrDefault(u => u != KinematicViscosity.BaseUnit && u != KinematicViscosityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == KinematicViscosityUnit.Undefined) + if (fromUnit == KinematicViscosityUnit.Undefined) fromUnit = KinematicViscosity.BaseUnit; var quantity = KinematicViscosity.From(3.0, fromUnit); @@ -448,7 +448,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(KinematicViscosityUnit)).Cast(); foreach(var unit in units) { - if(unit == KinematicViscosityUnit.Undefined) + if (unit == KinematicViscosityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LapseRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LapseRateTestsBase.g.cs index abd317b6b1..e90a232451 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LapseRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LapseRateTestsBase.g.cs @@ -208,7 +208,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(LapseRateUnit un var fromUnit = LapseRate.Units.FirstOrDefault(u => u != LapseRate.BaseUnit && u != LapseRateUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == LapseRateUnit.Undefined) + if (fromUnit == LapseRateUnit.Undefined) fromUnit = LapseRate.BaseUnit; var quantity = LapseRate.From(3.0, fromUnit); @@ -360,7 +360,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(LapseRateUnit)).Cast(); foreach(var unit in units) { - if(unit == LapseRateUnit.Undefined) + if (unit == LapseRateUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs index 4c7526e104..db53ca5f9f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs @@ -528,7 +528,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(LengthUnit unit) var fromUnit = Length.Units.FirstOrDefault(u => u != Length.BaseUnit && u != LengthUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == LengthUnit.Undefined) + if (fromUnit == LengthUnit.Undefined) fromUnit = Length.BaseUnit; var quantity = Length.From(3.0, fromUnit); @@ -712,7 +712,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(LengthUnit)).Cast(); foreach(var unit in units) { - if(unit == LengthUnit.Undefined) + if (unit == LengthUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs index 27aca88bbf..62d2cb8df6 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs @@ -218,7 +218,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(LevelUnit unit) var fromUnit = Level.Units.FirstOrDefault(u => u != Level.BaseUnit && u != LevelUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == LevelUnit.Undefined) + if (fromUnit == LevelUnit.Undefined) fromUnit = Level.BaseUnit; var quantity = Level.From(3.0, fromUnit); @@ -375,7 +375,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(LevelUnit)).Cast(); foreach(var unit in units) { - if(unit == LevelUnit.Undefined) + if (unit == LevelUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs index 94e1aab652..22e91543be 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs @@ -338,7 +338,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(LinearDensityUni var fromUnit = LinearDensity.Units.FirstOrDefault(u => u != LinearDensity.BaseUnit && u != LinearDensityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == LinearDensityUnit.Undefined) + if (fromUnit == LinearDensityUnit.Undefined) fromUnit = LinearDensity.BaseUnit; var quantity = LinearDensity.From(3.0, fromUnit); @@ -503,7 +503,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(LinearDensityUnit)).Cast(); foreach(var unit in units) { - if(unit == LinearDensityUnit.Undefined) + if (unit == LinearDensityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs index 9ced6699e2..c1787e6df8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs @@ -448,7 +448,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(LinearPowerDensi var fromUnit = LinearPowerDensity.Units.FirstOrDefault(u => u != LinearPowerDensity.BaseUnit && u != LinearPowerDensityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == LinearPowerDensityUnit.Undefined) + if (fromUnit == LinearPowerDensityUnit.Undefined) fromUnit = LinearPowerDensity.BaseUnit; var quantity = LinearPowerDensity.From(3.0, fromUnit); @@ -624,7 +624,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(LinearPowerDensityUnit)).Cast(); foreach(var unit in units) { - if(unit == LinearPowerDensityUnit.Undefined) + if (unit == LinearPowerDensityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs index 28c34e2b5c..09a74a8a56 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs @@ -338,7 +338,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(LuminosityUnit u var fromUnit = Luminosity.Units.FirstOrDefault(u => u != Luminosity.BaseUnit && u != LuminosityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == LuminosityUnit.Undefined) + if (fromUnit == LuminosityUnit.Undefined) fromUnit = Luminosity.BaseUnit; var quantity = Luminosity.From(3.0, fromUnit); @@ -503,7 +503,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(LuminosityUnit)).Cast(); foreach(var unit in units) { - if(unit == LuminosityUnit.Undefined) + if (unit == LuminosityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs index 4cbf4ecf65..d8121629d0 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs @@ -208,7 +208,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(LuminousFluxUnit var fromUnit = LuminousFlux.Units.FirstOrDefault(u => u != LuminousFlux.BaseUnit && u != LuminousFluxUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == LuminousFluxUnit.Undefined) + if (fromUnit == LuminousFluxUnit.Undefined) fromUnit = LuminousFlux.BaseUnit; var quantity = LuminousFlux.From(3.0, fromUnit); @@ -360,7 +360,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(LuminousFluxUnit)).Cast(); foreach(var unit in units) { - if(unit == LuminousFluxUnit.Undefined) + if (unit == LuminousFluxUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs index 6b4462baa1..e6f58cb3e8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs @@ -208,7 +208,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(LuminousIntensit var fromUnit = LuminousIntensity.Units.FirstOrDefault(u => u != LuminousIntensity.BaseUnit && u != LuminousIntensityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == LuminousIntensityUnit.Undefined) + if (fromUnit == LuminousIntensityUnit.Undefined) fromUnit = LuminousIntensity.BaseUnit; var quantity = LuminousIntensity.From(3.0, fromUnit); @@ -360,7 +360,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(LuminousIntensityUnit)).Cast(); foreach(var unit in units) { - if(unit == LuminousIntensityUnit.Undefined) + if (unit == LuminousIntensityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs index 535a956905..f27a8d877e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs @@ -258,7 +258,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(MagneticFieldUni var fromUnit = MagneticField.Units.FirstOrDefault(u => u != MagneticField.BaseUnit && u != MagneticFieldUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == MagneticFieldUnit.Undefined) + if (fromUnit == MagneticFieldUnit.Undefined) fromUnit = MagneticField.BaseUnit; var quantity = MagneticField.From(3.0, fromUnit); @@ -415,7 +415,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(MagneticFieldUnit)).Cast(); foreach(var unit in units) { - if(unit == MagneticFieldUnit.Undefined) + if (unit == MagneticFieldUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs index 53cceaa13a..5cd047273b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs @@ -208,7 +208,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(MagneticFluxUnit var fromUnit = MagneticFlux.Units.FirstOrDefault(u => u != MagneticFlux.BaseUnit && u != MagneticFluxUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == MagneticFluxUnit.Undefined) + if (fromUnit == MagneticFluxUnit.Undefined) fromUnit = MagneticFlux.BaseUnit; var quantity = MagneticFlux.From(3.0, fromUnit); @@ -360,7 +360,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(MagneticFluxUnit)).Cast(); foreach(var unit in units) { - if(unit == MagneticFluxUnit.Undefined) + if (unit == MagneticFluxUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs index f77864e13f..63e74492d3 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs @@ -208,7 +208,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(MagnetizationUni var fromUnit = Magnetization.Units.FirstOrDefault(u => u != Magnetization.BaseUnit && u != MagnetizationUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == MagnetizationUnit.Undefined) + if (fromUnit == MagnetizationUnit.Undefined) fromUnit = Magnetization.BaseUnit; var quantity = Magnetization.From(3.0, fromUnit); @@ -360,7 +360,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(MagnetizationUnit)).Cast(); foreach(var unit in units) { - if(unit == MagnetizationUnit.Undefined) + if (unit == MagnetizationUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs index 8281d5947a..3438958e79 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs @@ -688,7 +688,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(MassConcentratio var fromUnit = MassConcentration.Units.FirstOrDefault(u => u != MassConcentration.BaseUnit && u != MassConcentrationUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == MassConcentrationUnit.Undefined) + if (fromUnit == MassConcentrationUnit.Undefined) fromUnit = MassConcentration.BaseUnit; var quantity = MassConcentration.From(3.0, fromUnit); @@ -888,7 +888,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(MassConcentrationUnit)).Cast(); foreach(var unit in units) { - if(unit == MassConcentrationUnit.Undefined) + if (unit == MassConcentrationUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs index 8ca2653751..43b500c8fc 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs @@ -528,7 +528,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(MassFlowUnit uni var fromUnit = MassFlow.Units.FirstOrDefault(u => u != MassFlow.BaseUnit && u != MassFlowUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == MassFlowUnit.Undefined) + if (fromUnit == MassFlowUnit.Undefined) fromUnit = MassFlow.BaseUnit; var quantity = MassFlow.From(3.0, fromUnit); @@ -712,7 +712,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(MassFlowUnit)).Cast(); foreach(var unit in units) { - if(unit == MassFlowUnit.Undefined) + if (unit == MassFlowUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs index e4ee54db7d..35d4f7e051 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs @@ -318,7 +318,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(MassFluxUnit uni var fromUnit = MassFlux.Units.FirstOrDefault(u => u != MassFlux.BaseUnit && u != MassFluxUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == MassFluxUnit.Undefined) + if (fromUnit == MassFluxUnit.Undefined) fromUnit = MassFlux.BaseUnit; var quantity = MassFlux.From(3.0, fromUnit); @@ -481,7 +481,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(MassFluxUnit)).Cast(); foreach(var unit in units) { - if(unit == MassFluxUnit.Undefined) + if (unit == MassFluxUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs index 2e1f094d53..ad4c32f4c8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs @@ -438,7 +438,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(MassFractionUnit var fromUnit = MassFraction.Units.FirstOrDefault(u => u != MassFraction.BaseUnit && u != MassFractionUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == MassFractionUnit.Undefined) + if (fromUnit == MassFractionUnit.Undefined) fromUnit = MassFraction.BaseUnit; var quantity = MassFraction.From(3.0, fromUnit); @@ -613,7 +613,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(MassFractionUnit)).Cast(); foreach(var unit in units) { - if(unit == MassFractionUnit.Undefined) + if (unit == MassFractionUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs index f4b8bb0263..a53cfc175f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs @@ -478,7 +478,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(MassMomentOfIner var fromUnit = MassMomentOfInertia.Units.FirstOrDefault(u => u != MassMomentOfInertia.BaseUnit && u != MassMomentOfInertiaUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == MassMomentOfInertiaUnit.Undefined) + if (fromUnit == MassMomentOfInertiaUnit.Undefined) fromUnit = MassMomentOfInertia.BaseUnit; var quantity = MassMomentOfInertia.From(3.0, fromUnit); @@ -657,7 +657,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(MassMomentOfInertiaUnit)).Cast(); foreach(var unit in units) { - if(unit == MassMomentOfInertiaUnit.Undefined) + if (unit == MassMomentOfInertiaUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs index ae7364df1b..1e8bf56cce 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs @@ -448,7 +448,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(MassUnit unit) var fromUnit = Mass.Units.FirstOrDefault(u => u != Mass.BaseUnit && u != MassUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == MassUnit.Undefined) + if (fromUnit == MassUnit.Undefined) fromUnit = Mass.BaseUnit; var quantity = Mass.From(3.0, fromUnit); @@ -624,7 +624,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(MassUnit)).Cast(); foreach(var unit in units) { - if(unit == MassUnit.Undefined) + if (unit == MassUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs index fdbfa2178c..bb18ac8dd2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs @@ -228,7 +228,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(MolarEnergyUnit var fromUnit = MolarEnergy.Units.FirstOrDefault(u => u != MolarEnergy.BaseUnit && u != MolarEnergyUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == MolarEnergyUnit.Undefined) + if (fromUnit == MolarEnergyUnit.Undefined) fromUnit = MolarEnergy.BaseUnit; var quantity = MolarEnergy.From(3.0, fromUnit); @@ -382,7 +382,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(MolarEnergyUnit)).Cast(); foreach(var unit in units) { - if(unit == MolarEnergyUnit.Undefined) + if (unit == MolarEnergyUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs index 93ef01239e..77c3c0df9b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs @@ -228,7 +228,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(MolarEntropyUnit var fromUnit = MolarEntropy.Units.FirstOrDefault(u => u != MolarEntropy.BaseUnit && u != MolarEntropyUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == MolarEntropyUnit.Undefined) + if (fromUnit == MolarEntropyUnit.Undefined) fromUnit = MolarEntropy.BaseUnit; var quantity = MolarEntropy.From(3.0, fromUnit); @@ -382,7 +382,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(MolarEntropyUnit)).Cast(); foreach(var unit in units) { - if(unit == MolarEntropyUnit.Undefined) + if (unit == MolarEntropyUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs index b6b58539ad..e006b3cb68 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs @@ -318,7 +318,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(MolarMassUnit un var fromUnit = MolarMass.Units.FirstOrDefault(u => u != MolarMass.BaseUnit && u != MolarMassUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == MolarMassUnit.Undefined) + if (fromUnit == MolarMassUnit.Undefined) fromUnit = MolarMass.BaseUnit; var quantity = MolarMass.From(3.0, fromUnit); @@ -481,7 +481,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(MolarMassUnit)).Cast(); foreach(var unit in units) { - if(unit == MolarMassUnit.Undefined) + if (unit == MolarMassUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs index 1c6d1b38cf..21a68d7004 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs @@ -342,7 +342,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(MolarityUnit uni var fromUnit = Molarity.Units.FirstOrDefault(u => u != Molarity.BaseUnit && u != MolarityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == MolarityUnit.Undefined) + if (fromUnit == MolarityUnit.Undefined) fromUnit = Molarity.BaseUnit; var quantity = Molarity.From(3.0, fromUnit); @@ -509,7 +509,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(MolarityUnit)).Cast(); foreach(var unit in units) { - if(unit == MolarityUnit.Undefined) + if (unit == MolarityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs index bfc744d102..65b0a35717 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs @@ -208,7 +208,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(PermeabilityUnit var fromUnit = Permeability.Units.FirstOrDefault(u => u != Permeability.BaseUnit && u != PermeabilityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == PermeabilityUnit.Undefined) + if (fromUnit == PermeabilityUnit.Undefined) fromUnit = Permeability.BaseUnit; var quantity = Permeability.From(3.0, fromUnit); @@ -360,7 +360,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(PermeabilityUnit)).Cast(); foreach(var unit in units) { - if(unit == PermeabilityUnit.Undefined) + if (unit == PermeabilityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs index 553dc76b6c..a788e5f7f8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs @@ -208,7 +208,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(PermittivityUnit var fromUnit = Permittivity.Units.FirstOrDefault(u => u != Permittivity.BaseUnit && u != PermittivityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == PermittivityUnit.Undefined) + if (fromUnit == PermittivityUnit.Undefined) fromUnit = Permittivity.BaseUnit; var quantity = Permittivity.From(3.0, fromUnit); @@ -360,7 +360,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(PermittivityUnit)).Cast(); foreach(var unit in units) { - if(unit == PermittivityUnit.Undefined) + if (unit == PermittivityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs index 5a479b3bc7..ce63e72e0a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs @@ -638,7 +638,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(PowerDensityUnit var fromUnit = PowerDensity.Units.FirstOrDefault(u => u != PowerDensity.BaseUnit && u != PowerDensityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == PowerDensityUnit.Undefined) + if (fromUnit == PowerDensityUnit.Undefined) fromUnit = PowerDensity.BaseUnit; var quantity = PowerDensity.From(3.0, fromUnit); @@ -833,7 +833,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(PowerDensityUnit)).Cast(); foreach(var unit in units) { - if(unit == PowerDensityUnit.Undefined) + if (unit == PowerDensityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs index 2105344f09..c51f1e32f5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs @@ -218,7 +218,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(PowerRatioUnit u var fromUnit = PowerRatio.Units.FirstOrDefault(u => u != PowerRatio.BaseUnit && u != PowerRatioUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == PowerRatioUnit.Undefined) + if (fromUnit == PowerRatioUnit.Undefined) fromUnit = PowerRatio.BaseUnit; var quantity = PowerRatio.From(3.0, fromUnit); @@ -375,7 +375,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(PowerRatioUnit)).Cast(); foreach(var unit in units) { - if(unit == PowerRatioUnit.Undefined) + if (unit == PowerRatioUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs index 7dcfd7a6a4..ec1f93638d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs @@ -423,7 +423,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(PowerUnit unit) var fromUnit = Power.Units.FirstOrDefault(u => u != Power.BaseUnit && u != PowerUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == PowerUnit.Undefined) + if (fromUnit == PowerUnit.Undefined) fromUnit = Power.BaseUnit; var quantity = Power.From(3.0, fromUnit); @@ -599,7 +599,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(PowerUnit)).Cast(); foreach(var unit in units) { - if(unit == PowerUnit.Undefined) + if (unit == PowerUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs index 6a73fa3571..bdb834b953 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs @@ -338,7 +338,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(PressureChangeRa var fromUnit = PressureChangeRate.Units.FirstOrDefault(u => u != PressureChangeRate.BaseUnit && u != PressureChangeRateUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == PressureChangeRateUnit.Undefined) + if (fromUnit == PressureChangeRateUnit.Undefined) fromUnit = PressureChangeRate.BaseUnit; var quantity = PressureChangeRate.From(3.0, fromUnit); @@ -503,7 +503,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(PressureChangeRateUnit)).Cast(); foreach(var unit in units) { - if(unit == PressureChangeRateUnit.Undefined) + if (unit == PressureChangeRateUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs index 5c78f02394..5bbd9e71ca 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs @@ -648,7 +648,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(PressureUnit uni var fromUnit = Pressure.Units.FirstOrDefault(u => u != Pressure.BaseUnit && u != PressureUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == PressureUnit.Undefined) + if (fromUnit == PressureUnit.Undefined) fromUnit = Pressure.BaseUnit; var quantity = Pressure.From(3.0, fromUnit); @@ -844,7 +844,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(PressureUnit)).Cast(); foreach(var unit in units) { - if(unit == PressureUnit.Undefined) + if (unit == PressureUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs index 41395a85c3..60fad593b4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs @@ -218,7 +218,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(RatioChangeRateU var fromUnit = RatioChangeRate.Units.FirstOrDefault(u => u != RatioChangeRate.BaseUnit && u != RatioChangeRateUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == RatioChangeRateUnit.Undefined) + if (fromUnit == RatioChangeRateUnit.Undefined) fromUnit = RatioChangeRate.BaseUnit; var quantity = RatioChangeRate.From(3.0, fromUnit); @@ -371,7 +371,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(RatioChangeRateUnit)).Cast(); foreach(var unit in units) { - if(unit == RatioChangeRateUnit.Undefined) + if (unit == RatioChangeRateUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs index 58ab0bb668..f9cbe503ee 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs @@ -258,7 +258,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(RatioUnit unit) var fromUnit = Ratio.Units.FirstOrDefault(u => u != Ratio.BaseUnit && u != RatioUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == RatioUnit.Undefined) + if (fromUnit == RatioUnit.Undefined) fromUnit = Ratio.BaseUnit; var quantity = Ratio.From(3.0, fromUnit); @@ -415,7 +415,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(RatioUnit)).Cast(); foreach(var unit in units) { - if(unit == RatioUnit.Undefined) + if (unit == RatioUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs index 26420e02ad..83b62194d5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs @@ -228,7 +228,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ReactiveEnergyUn var fromUnit = ReactiveEnergy.Units.FirstOrDefault(u => u != ReactiveEnergy.BaseUnit && u != ReactiveEnergyUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ReactiveEnergyUnit.Undefined) + if (fromUnit == ReactiveEnergyUnit.Undefined) fromUnit = ReactiveEnergy.BaseUnit; var quantity = ReactiveEnergy.From(3.0, fromUnit); @@ -382,7 +382,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ReactiveEnergyUnit)).Cast(); foreach(var unit in units) { - if(unit == ReactiveEnergyUnit.Undefined) + if (unit == ReactiveEnergyUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs index 9b122787b6..85c475be10 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs @@ -238,7 +238,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ReactivePowerUni var fromUnit = ReactivePower.Units.FirstOrDefault(u => u != ReactivePower.BaseUnit && u != ReactivePowerUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ReactivePowerUnit.Undefined) + if (fromUnit == ReactivePowerUnit.Undefined) fromUnit = ReactivePower.BaseUnit; var quantity = ReactivePower.From(3.0, fromUnit); @@ -393,7 +393,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ReactivePowerUnit)).Cast(); foreach(var unit in units) { - if(unit == ReactivePowerUnit.Undefined) + if (unit == ReactivePowerUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs index 639244d32b..f2ab4dcfdb 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs @@ -308,7 +308,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ReciprocalAreaUn var fromUnit = ReciprocalArea.Units.FirstOrDefault(u => u != ReciprocalArea.BaseUnit && u != ReciprocalAreaUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ReciprocalAreaUnit.Undefined) + if (fromUnit == ReciprocalAreaUnit.Undefined) fromUnit = ReciprocalArea.BaseUnit; var quantity = ReciprocalArea.From(3.0, fromUnit); @@ -470,7 +470,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ReciprocalAreaUnit)).Cast(); foreach(var unit in units) { - if(unit == ReciprocalAreaUnit.Undefined) + if (unit == ReciprocalAreaUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs index 96ae80abdd..eef555d82b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs @@ -298,7 +298,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ReciprocalLength var fromUnit = ReciprocalLength.Units.FirstOrDefault(u => u != ReciprocalLength.BaseUnit && u != ReciprocalLengthUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ReciprocalLengthUnit.Undefined) + if (fromUnit == ReciprocalLengthUnit.Undefined) fromUnit = ReciprocalLength.BaseUnit; var quantity = ReciprocalLength.From(3.0, fromUnit); @@ -459,7 +459,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ReciprocalLengthUnit)).Cast(); foreach(var unit in units) { - if(unit == ReciprocalLengthUnit.Undefined) + if (unit == ReciprocalLengthUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs index 736579b1a4..b4ce25b4ec 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs @@ -208,7 +208,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(RelativeHumidity var fromUnit = RelativeHumidity.Units.FirstOrDefault(u => u != RelativeHumidity.BaseUnit && u != RelativeHumidityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == RelativeHumidityUnit.Undefined) + if (fromUnit == RelativeHumidityUnit.Undefined) fromUnit = RelativeHumidity.BaseUnit; var quantity = RelativeHumidity.From(3.0, fromUnit); @@ -360,7 +360,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(RelativeHumidityUnit)).Cast(); foreach(var unit in units) { - if(unit == RelativeHumidityUnit.Undefined) + if (unit == RelativeHumidityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs index 63d84cdbdc..e25feb2228 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs @@ -238,7 +238,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(RotationalAccele var fromUnit = RotationalAcceleration.Units.FirstOrDefault(u => u != RotationalAcceleration.BaseUnit && u != RotationalAccelerationUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == RotationalAccelerationUnit.Undefined) + if (fromUnit == RotationalAccelerationUnit.Undefined) fromUnit = RotationalAcceleration.BaseUnit; var quantity = RotationalAcceleration.From(3.0, fromUnit); @@ -393,7 +393,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(RotationalAccelerationUnit)).Cast(); foreach(var unit in units) { - if(unit == RotationalAccelerationUnit.Undefined) + if (unit == RotationalAccelerationUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs index d6e6f12cf1..c90abcd0ca 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs @@ -328,7 +328,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(RotationalSpeedU var fromUnit = RotationalSpeed.Units.FirstOrDefault(u => u != RotationalSpeed.BaseUnit && u != RotationalSpeedUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == RotationalSpeedUnit.Undefined) + if (fromUnit == RotationalSpeedUnit.Undefined) fromUnit = RotationalSpeed.BaseUnit; var quantity = RotationalSpeed.From(3.0, fromUnit); @@ -492,7 +492,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(RotationalSpeedUnit)).Cast(); foreach(var unit in units) { - if(unit == RotationalSpeedUnit.Undefined) + if (unit == RotationalSpeedUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs index 763be52685..b565729530 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs @@ -248,7 +248,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(RotationalStiffn var fromUnit = RotationalStiffnessPerLength.Units.FirstOrDefault(u => u != RotationalStiffnessPerLength.BaseUnit && u != RotationalStiffnessPerLengthUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == RotationalStiffnessPerLengthUnit.Undefined) + if (fromUnit == RotationalStiffnessPerLengthUnit.Undefined) fromUnit = RotationalStiffnessPerLength.BaseUnit; var quantity = RotationalStiffnessPerLength.From(3.0, fromUnit); @@ -404,7 +404,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(RotationalStiffnessPerLengthUnit)).Cast(); foreach(var unit in units) { - if(unit == RotationalStiffnessPerLengthUnit.Undefined) + if (unit == RotationalStiffnessPerLengthUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs index 6129bd22c8..fe975d5151 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs @@ -528,7 +528,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(RotationalStiffn var fromUnit = RotationalStiffness.Units.FirstOrDefault(u => u != RotationalStiffness.BaseUnit && u != RotationalStiffnessUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == RotationalStiffnessUnit.Undefined) + if (fromUnit == RotationalStiffnessUnit.Undefined) fromUnit = RotationalStiffness.BaseUnit; var quantity = RotationalStiffness.From(3.0, fromUnit); @@ -712,7 +712,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(RotationalStiffnessUnit)).Cast(); foreach(var unit in units) { - if(unit == RotationalStiffnessUnit.Undefined) + if (unit == RotationalStiffnessUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs index 0a1f6c8422..b2a03eb79d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs @@ -208,7 +208,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ScalarUnit unit) var fromUnit = Scalar.Units.FirstOrDefault(u => u != Scalar.BaseUnit && u != ScalarUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ScalarUnit.Undefined) + if (fromUnit == ScalarUnit.Undefined) fromUnit = Scalar.BaseUnit; var quantity = Scalar.From(3.0, fromUnit); @@ -360,7 +360,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ScalarUnit)).Cast(); foreach(var unit in units) { - if(unit == ScalarUnit.Undefined) + if (unit == ScalarUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs index 505594fca5..d8d5dcf536 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs @@ -208,7 +208,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(SolidAngleUnit u var fromUnit = SolidAngle.Units.FirstOrDefault(u => u != SolidAngle.BaseUnit && u != SolidAngleUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == SolidAngleUnit.Undefined) + if (fromUnit == SolidAngleUnit.Undefined) fromUnit = SolidAngle.BaseUnit; var quantity = SolidAngle.From(3.0, fromUnit); @@ -360,7 +360,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(SolidAngleUnit)).Cast(); foreach(var unit in units) { - if(unit == SolidAngleUnit.Undefined) + if (unit == SolidAngleUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs index 00999677a8..89c15abe0f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs @@ -448,7 +448,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(SpecificEnergyUn var fromUnit = SpecificEnergy.Units.FirstOrDefault(u => u != SpecificEnergy.BaseUnit && u != SpecificEnergyUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == SpecificEnergyUnit.Undefined) + if (fromUnit == SpecificEnergyUnit.Undefined) fromUnit = SpecificEnergy.BaseUnit; var quantity = SpecificEnergy.From(3.0, fromUnit); @@ -624,7 +624,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(SpecificEnergyUnit)).Cast(); foreach(var unit in units) { - if(unit == SpecificEnergyUnit.Undefined) + if (unit == SpecificEnergyUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs index 9c9f018be4..ef9bc0231f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs @@ -288,7 +288,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(SpecificEntropyU var fromUnit = SpecificEntropy.Units.FirstOrDefault(u => u != SpecificEntropy.BaseUnit && u != SpecificEntropyUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == SpecificEntropyUnit.Undefined) + if (fromUnit == SpecificEntropyUnit.Undefined) fromUnit = SpecificEntropy.BaseUnit; var quantity = SpecificEntropy.From(3.0, fromUnit); @@ -448,7 +448,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(SpecificEntropyUnit)).Cast(); foreach(var unit in units) { - if(unit == SpecificEntropyUnit.Undefined) + if (unit == SpecificEntropyUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs index 99dca952d1..777d60411a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs @@ -238,7 +238,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(SpecificFuelCons var fromUnit = SpecificFuelConsumption.Units.FirstOrDefault(u => u != SpecificFuelConsumption.BaseUnit && u != SpecificFuelConsumptionUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == SpecificFuelConsumptionUnit.Undefined) + if (fromUnit == SpecificFuelConsumptionUnit.Undefined) fromUnit = SpecificFuelConsumption.BaseUnit; var quantity = SpecificFuelConsumption.From(3.0, fromUnit); @@ -393,7 +393,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(SpecificFuelConsumptionUnit)).Cast(); foreach(var unit in units) { - if(unit == SpecificFuelConsumptionUnit.Undefined) + if (unit == SpecificFuelConsumptionUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs index 3547c01001..175120f6ab 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs @@ -228,7 +228,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(SpecificVolumeUn var fromUnit = SpecificVolume.Units.FirstOrDefault(u => u != SpecificVolume.BaseUnit && u != SpecificVolumeUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == SpecificVolumeUnit.Undefined) + if (fromUnit == SpecificVolumeUnit.Undefined) fromUnit = SpecificVolume.BaseUnit; var quantity = SpecificVolume.From(3.0, fromUnit); @@ -382,7 +382,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(SpecificVolumeUnit)).Cast(); foreach(var unit in units) { - if(unit == SpecificVolumeUnit.Undefined) + if (unit == SpecificVolumeUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs index 631236e82c..541367fbba 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs @@ -368,7 +368,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(SpecificWeightUn var fromUnit = SpecificWeight.Units.FirstOrDefault(u => u != SpecificWeight.BaseUnit && u != SpecificWeightUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == SpecificWeightUnit.Undefined) + if (fromUnit == SpecificWeightUnit.Undefined) fromUnit = SpecificWeight.BaseUnit; var quantity = SpecificWeight.From(3.0, fromUnit); @@ -536,7 +536,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(SpecificWeightUnit)).Cast(); foreach(var unit in units) { - if(unit == SpecificWeightUnit.Undefined) + if (unit == SpecificWeightUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs index d1ba6b077a..34947fbedb 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs @@ -518,7 +518,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(SpeedUnit unit) var fromUnit = Speed.Units.FirstOrDefault(u => u != Speed.BaseUnit && u != SpeedUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == SpeedUnit.Undefined) + if (fromUnit == SpeedUnit.Undefined) fromUnit = Speed.BaseUnit; var quantity = Speed.From(3.0, fromUnit); @@ -701,7 +701,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(SpeedUnit)).Cast(); foreach(var unit in units) { - if(unit == SpeedUnit.Undefined) + if (unit == SpeedUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs index eabb7fd0f9..bad48d5227 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs @@ -288,7 +288,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(StandardVolumeFl var fromUnit = StandardVolumeFlow.Units.FirstOrDefault(u => u != StandardVolumeFlow.BaseUnit && u != StandardVolumeFlowUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == StandardVolumeFlowUnit.Undefined) + if (fromUnit == StandardVolumeFlowUnit.Undefined) fromUnit = StandardVolumeFlow.BaseUnit; var quantity = StandardVolumeFlow.From(3.0, fromUnit); @@ -448,7 +448,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(StandardVolumeFlowUnit)).Cast(); foreach(var unit in units) { - if(unit == StandardVolumeFlowUnit.Undefined) + if (unit == StandardVolumeFlowUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs index 8af86a0b20..8783adf099 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs @@ -298,7 +298,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(TemperatureChang var fromUnit = TemperatureChangeRate.Units.FirstOrDefault(u => u != TemperatureChangeRate.BaseUnit && u != TemperatureChangeRateUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == TemperatureChangeRateUnit.Undefined) + if (fromUnit == TemperatureChangeRateUnit.Undefined) fromUnit = TemperatureChangeRate.BaseUnit; var quantity = TemperatureChangeRate.From(3.0, fromUnit); @@ -459,7 +459,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(TemperatureChangeRateUnit)).Cast(); foreach(var unit in units) { - if(unit == TemperatureChangeRateUnit.Undefined) + if (unit == TemperatureChangeRateUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs index 8c51fb93b6..ba05bd5b86 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs @@ -288,7 +288,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(TemperatureDelta var fromUnit = TemperatureDelta.Units.FirstOrDefault(u => u != TemperatureDelta.BaseUnit && u != TemperatureDeltaUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == TemperatureDeltaUnit.Undefined) + if (fromUnit == TemperatureDeltaUnit.Undefined) fromUnit = TemperatureDelta.BaseUnit; var quantity = TemperatureDelta.From(3.0, fromUnit); @@ -448,7 +448,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(TemperatureDeltaUnit)).Cast(); foreach(var unit in units) { - if(unit == TemperatureDeltaUnit.Undefined) + if (unit == TemperatureDeltaUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs index 75372fd4e2..fe7c385576 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs @@ -238,7 +238,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(TemperatureGradi var fromUnit = TemperatureGradient.Units.FirstOrDefault(u => u != TemperatureGradient.BaseUnit && u != TemperatureGradientUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == TemperatureGradientUnit.Undefined) + if (fromUnit == TemperatureGradientUnit.Undefined) fromUnit = TemperatureGradient.BaseUnit; var quantity = TemperatureGradient.From(3.0, fromUnit); @@ -393,7 +393,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(TemperatureGradientUnit)).Cast(); foreach(var unit in units) { - if(unit == TemperatureGradientUnit.Undefined) + if (unit == TemperatureGradientUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs index 9e0c160da4..0781fbe446 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs @@ -298,7 +298,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(TemperatureUnit var fromUnit = Temperature.Units.FirstOrDefault(u => u != Temperature.BaseUnit && u != TemperatureUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == TemperatureUnit.Undefined) + if (fromUnit == TemperatureUnit.Undefined) fromUnit = Temperature.BaseUnit; var quantity = Temperature.From(3.0, fromUnit); @@ -447,7 +447,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(TemperatureUnit)).Cast(); foreach(var unit in units) { - if(unit == TemperatureUnit.Undefined) + if (unit == TemperatureUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs index 2fd369651a..54bfd18453 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs @@ -218,7 +218,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ThermalConductiv var fromUnit = ThermalConductivity.Units.FirstOrDefault(u => u != ThermalConductivity.BaseUnit && u != ThermalConductivityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ThermalConductivityUnit.Undefined) + if (fromUnit == ThermalConductivityUnit.Undefined) fromUnit = ThermalConductivity.BaseUnit; var quantity = ThermalConductivity.From(3.0, fromUnit); @@ -371,7 +371,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ThermalConductivityUnit)).Cast(); foreach(var unit in units) { - if(unit == ThermalConductivityUnit.Undefined) + if (unit == ThermalConductivityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs index 213aea5006..677cff7792 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs @@ -258,7 +258,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(ThermalResistanc var fromUnit = ThermalResistance.Units.FirstOrDefault(u => u != ThermalResistance.BaseUnit && u != ThermalResistanceUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == ThermalResistanceUnit.Undefined) + if (fromUnit == ThermalResistanceUnit.Undefined) fromUnit = ThermalResistance.BaseUnit; var quantity = ThermalResistance.From(3.0, fromUnit); @@ -415,7 +415,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(ThermalResistanceUnit)).Cast(); foreach(var unit in units) { - if(unit == ThermalResistanceUnit.Undefined) + if (unit == ThermalResistanceUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs index 96315802a1..38ef184aef 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs @@ -408,7 +408,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(TorquePerLengthU var fromUnit = TorquePerLength.Units.FirstOrDefault(u => u != TorquePerLength.BaseUnit && u != TorquePerLengthUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == TorquePerLengthUnit.Undefined) + if (fromUnit == TorquePerLengthUnit.Undefined) fromUnit = TorquePerLength.BaseUnit; var quantity = TorquePerLength.From(3.0, fromUnit); @@ -580,7 +580,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(TorquePerLengthUnit)).Cast(); foreach(var unit in units) { - if(unit == TorquePerLengthUnit.Undefined) + if (unit == TorquePerLengthUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs index 6f91770d4b..7bda2d6531 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs @@ -448,7 +448,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(TorqueUnit unit) var fromUnit = Torque.Units.FirstOrDefault(u => u != Torque.BaseUnit && u != TorqueUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == TorqueUnit.Undefined) + if (fromUnit == TorqueUnit.Undefined) fromUnit = Torque.BaseUnit; var quantity = Torque.From(3.0, fromUnit); @@ -624,7 +624,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(TorqueUnit)).Cast(); foreach(var unit in units) { - if(unit == TorqueUnit.Undefined) + if (unit == TorqueUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs index 808250da97..f131675530 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs @@ -208,7 +208,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(TurbidityUnit un var fromUnit = Turbidity.Units.FirstOrDefault(u => u != Turbidity.BaseUnit && u != TurbidityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == TurbidityUnit.Undefined) + if (fromUnit == TurbidityUnit.Undefined) fromUnit = Turbidity.BaseUnit; var quantity = Turbidity.From(3.0, fromUnit); @@ -360,7 +360,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(TurbidityUnit)).Cast(); foreach(var unit in units) { - if(unit == TurbidityUnit.Undefined) + if (unit == TurbidityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs index 0858d5e41e..c52824d979 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs @@ -208,7 +208,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(VitaminAUnit uni var fromUnit = VitaminA.Units.FirstOrDefault(u => u != VitaminA.BaseUnit && u != VitaminAUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == VitaminAUnit.Undefined) + if (fromUnit == VitaminAUnit.Undefined) fromUnit = VitaminA.BaseUnit; var quantity = VitaminA.From(3.0, fromUnit); @@ -360,7 +360,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(VitaminAUnit)).Cast(); foreach(var unit in units) { - if(unit == VitaminAUnit.Undefined) + if (unit == VitaminAUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs index 9db1eea2be..845a8ccbb2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs @@ -398,7 +398,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(VolumeConcentrat var fromUnit = VolumeConcentration.Units.FirstOrDefault(u => u != VolumeConcentration.BaseUnit && u != VolumeConcentrationUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == VolumeConcentrationUnit.Undefined) + if (fromUnit == VolumeConcentrationUnit.Undefined) fromUnit = VolumeConcentration.BaseUnit; var quantity = VolumeConcentration.From(3.0, fromUnit); @@ -569,7 +569,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(VolumeConcentrationUnit)).Cast(); foreach(var unit in units) { - if(unit == VolumeConcentrationUnit.Undefined) + if (unit == VolumeConcentrationUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs index 6758c1bdb2..f5f1aa37e0 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs @@ -218,7 +218,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(VolumeFlowPerAre var fromUnit = VolumeFlowPerArea.Units.FirstOrDefault(u => u != VolumeFlowPerArea.BaseUnit && u != VolumeFlowPerAreaUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == VolumeFlowPerAreaUnit.Undefined) + if (fromUnit == VolumeFlowPerAreaUnit.Undefined) fromUnit = VolumeFlowPerArea.BaseUnit; var quantity = VolumeFlowPerArea.From(3.0, fromUnit); @@ -371,7 +371,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(VolumeFlowPerAreaUnit)).Cast(); foreach(var unit in units) { - if(unit == VolumeFlowPerAreaUnit.Undefined) + if (unit == VolumeFlowPerAreaUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs index bbbc2ee7a6..dafec8f3b8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs @@ -818,7 +818,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(VolumeFlowUnit u var fromUnit = VolumeFlow.Units.FirstOrDefault(u => u != VolumeFlow.BaseUnit && u != VolumeFlowUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == VolumeFlowUnit.Undefined) + if (fromUnit == VolumeFlowUnit.Undefined) fromUnit = VolumeFlow.BaseUnit; var quantity = VolumeFlow.From(3.0, fromUnit); @@ -1031,7 +1031,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(VolumeFlowUnit)).Cast(); foreach(var unit in units) { - if(unit == VolumeFlowUnit.Undefined) + if (unit == VolumeFlowUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs index 99b3b19301..14bd5456cf 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs @@ -268,7 +268,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(VolumePerLengthU var fromUnit = VolumePerLength.Units.FirstOrDefault(u => u != VolumePerLength.BaseUnit && u != VolumePerLengthUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == VolumePerLengthUnit.Undefined) + if (fromUnit == VolumePerLengthUnit.Undefined) fromUnit = VolumePerLength.BaseUnit; var quantity = VolumePerLength.From(3.0, fromUnit); @@ -426,7 +426,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(VolumePerLengthUnit)).Cast(); foreach(var unit in units) { - if(unit == VolumePerLengthUnit.Undefined) + if (unit == VolumePerLengthUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs index 53acb7dd64..d8e580e8c7 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs @@ -708,7 +708,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(VolumeUnit unit) var fromUnit = Volume.Units.FirstOrDefault(u => u != Volume.BaseUnit && u != VolumeUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == VolumeUnit.Undefined) + if (fromUnit == VolumeUnit.Undefined) fromUnit = Volume.BaseUnit; var quantity = Volume.From(3.0, fromUnit); @@ -910,7 +910,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(VolumeUnit)).Cast(); foreach(var unit in units) { - if(unit == VolumeUnit.Undefined) + if (unit == VolumeUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs index 68f191f66c..f15ad02d72 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs @@ -288,7 +288,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(VolumetricHeatCa var fromUnit = VolumetricHeatCapacity.Units.FirstOrDefault(u => u != VolumetricHeatCapacity.BaseUnit && u != VolumetricHeatCapacityUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == VolumetricHeatCapacityUnit.Undefined) + if (fromUnit == VolumetricHeatCapacityUnit.Undefined) fromUnit = VolumetricHeatCapacity.BaseUnit; var quantity = VolumetricHeatCapacity.From(3.0, fromUnit); @@ -448,7 +448,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(VolumetricHeatCapacityUnit)).Cast(); foreach(var unit in units) { - if(unit == VolumetricHeatCapacityUnit.Undefined) + if (unit == VolumetricHeatCapacityUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs index 6f1677cfb9..85d26c40dd 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs @@ -258,7 +258,7 @@ public void ToUnit_FromNonBaseUnit_ReturnsQuantityWithGivenUnit(WarpingMomentOfI var fromUnit = WarpingMomentOfInertia.Units.FirstOrDefault(u => u != WarpingMomentOfInertia.BaseUnit && u != WarpingMomentOfInertiaUnit.Undefined); // If there is only one unit for the quantity, we must use the base unit. - if(fromUnit == WarpingMomentOfInertiaUnit.Undefined) + if (fromUnit == WarpingMomentOfInertiaUnit.Undefined) fromUnit = WarpingMomentOfInertia.BaseUnit; var quantity = WarpingMomentOfInertia.From(3.0, fromUnit); @@ -415,7 +415,7 @@ public void HasAtLeastOneAbbreviationSpecified() var units = Enum.GetValues(typeof(WarpingMomentOfInertiaUnit)).Cast(); foreach(var unit in units) { - if(unit == WarpingMomentOfInertiaUnit.Undefined) + if (unit == WarpingMomentOfInertiaUnit.Undefined) continue; var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.g.cs index 04bdc0081a..b4592b6b98 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.g.cs @@ -79,7 +79,7 @@ public Acceleration() /// If value is NaN or Infinity. private Acceleration(double value, AccelerationUnit unit) { - if(unit == AccelerationUnit.Undefined) + if (unit == AccelerationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -602,8 +602,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Acceleration objAcceleration)) throw new ArgumentException("Expected type Acceleration.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Acceleration objAcceleration)) throw new ArgumentException("Expected type Acceleration.", nameof(obj)); return CompareTo(objAcceleration); } @@ -617,7 +617,7 @@ internal int CompareTo(Acceleration other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Acceleration objAcceleration)) + if (obj is null || !(obj is Acceleration objAcceleration)) return false; return Equals(objAcceleration); @@ -670,7 +670,7 @@ public bool Equals(Acceleration other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Acceleration other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -700,7 +700,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(AccelerationUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -747,7 +747,7 @@ private double AsBaseUnit() private double AsBaseNumericType(AccelerationUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.g.cs index 7f7be2265f..6ded208b08 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -79,7 +79,7 @@ public AmountOfSubstance() /// If value is NaN or Infinity. private AmountOfSubstance(double value, AmountOfSubstanceUnit unit) { - if(unit == AmountOfSubstanceUnit.Undefined) + if (unit == AmountOfSubstanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -604,8 +604,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AmountOfSubstance objAmountOfSubstance)) throw new ArgumentException("Expected type AmountOfSubstance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is AmountOfSubstance objAmountOfSubstance)) throw new ArgumentException("Expected type AmountOfSubstance.", nameof(obj)); return CompareTo(objAmountOfSubstance); } @@ -619,7 +619,7 @@ internal int CompareTo(AmountOfSubstance other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is AmountOfSubstance objAmountOfSubstance)) + if (obj is null || !(obj is AmountOfSubstance objAmountOfSubstance)) return false; return Equals(objAmountOfSubstance); @@ -672,7 +672,7 @@ public bool Equals(AmountOfSubstance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(AmountOfSubstance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -702,7 +702,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(AmountOfSubstanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -750,7 +750,7 @@ private double AsBaseUnit() private double AsBaseNumericType(AmountOfSubstanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.g.cs index b1421b1415..2658f06084 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.g.cs @@ -79,7 +79,7 @@ public AmplitudeRatio() /// If value is NaN or Infinity. private AmplitudeRatio(double value, AmplitudeRatioUnit unit) { - if(unit == AmplitudeRatioUnit.Undefined) + if (unit == AmplitudeRatioUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -428,8 +428,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AmplitudeRatio objAmplitudeRatio)) throw new ArgumentException("Expected type AmplitudeRatio.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is AmplitudeRatio objAmplitudeRatio)) throw new ArgumentException("Expected type AmplitudeRatio.", nameof(obj)); return CompareTo(objAmplitudeRatio); } @@ -443,7 +443,7 @@ internal int CompareTo(AmplitudeRatio other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is AmplitudeRatio objAmplitudeRatio)) + if (obj is null || !(obj is AmplitudeRatio objAmplitudeRatio)) return false; return Equals(objAmplitudeRatio); @@ -496,7 +496,7 @@ public bool Equals(AmplitudeRatio other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(AmplitudeRatio other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -526,7 +526,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(AmplitudeRatioUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -563,7 +563,7 @@ private double AsBaseUnit() private double AsBaseNumericType(AmplitudeRatioUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.g.cs index 5a1aa06c96..5ad757190d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.g.cs @@ -79,7 +79,7 @@ public Angle() /// If value is NaN or Infinity. private Angle(double value, AngleUnit unit) { - if(unit == AngleUnit.Undefined) + if (unit == AngleUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -632,8 +632,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Angle objAngle)) throw new ArgumentException("Expected type Angle.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Angle objAngle)) throw new ArgumentException("Expected type Angle.", nameof(obj)); return CompareTo(objAngle); } @@ -647,7 +647,7 @@ internal int CompareTo(Angle other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Angle objAngle)) + if (obj is null || !(obj is Angle objAngle)) return false; return Equals(objAngle); @@ -700,7 +700,7 @@ public bool Equals(Angle other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Angle other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -730,7 +730,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(AngleUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -779,7 +779,7 @@ private double AsBaseUnit() private double AsBaseNumericType(AngleUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.g.cs index 3dd71d18fc..e26c18cad0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.g.cs @@ -79,7 +79,7 @@ public ApparentEnergy() /// If value is NaN or Infinity. private ApparentEnergy(double value, ApparentEnergyUnit unit) { - if(unit == ApparentEnergyUnit.Undefined) + if (unit == ApparentEnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -412,8 +412,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ApparentEnergy objApparentEnergy)) throw new ArgumentException("Expected type ApparentEnergy.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ApparentEnergy objApparentEnergy)) throw new ArgumentException("Expected type ApparentEnergy.", nameof(obj)); return CompareTo(objApparentEnergy); } @@ -427,7 +427,7 @@ internal int CompareTo(ApparentEnergy other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ApparentEnergy objApparentEnergy)) + if (obj is null || !(obj is ApparentEnergy objApparentEnergy)) return false; return Equals(objApparentEnergy); @@ -480,7 +480,7 @@ public bool Equals(ApparentEnergy other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ApparentEnergy other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -510,7 +510,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ApparentEnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -546,7 +546,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ApparentEnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.g.cs index 20f70543c3..40fd999091 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.g.cs @@ -79,7 +79,7 @@ public ApparentPower() /// If value is NaN or Infinity. private ApparentPower(double value, ApparentPowerUnit unit) { - if(unit == ApparentPowerUnit.Undefined) + if (unit == ApparentPowerUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -428,8 +428,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ApparentPower objApparentPower)) throw new ArgumentException("Expected type ApparentPower.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ApparentPower objApparentPower)) throw new ArgumentException("Expected type ApparentPower.", nameof(obj)); return CompareTo(objApparentPower); } @@ -443,7 +443,7 @@ internal int CompareTo(ApparentPower other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ApparentPower objApparentPower)) + if (obj is null || !(obj is ApparentPower objApparentPower)) return false; return Equals(objApparentPower); @@ -496,7 +496,7 @@ public bool Equals(ApparentPower other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ApparentPower other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -526,7 +526,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ApparentPowerUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -563,7 +563,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ApparentPowerUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.g.cs index b95170e5fe..4e537de485 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.g.cs @@ -79,7 +79,7 @@ public Area() /// If value is NaN or Infinity. private Area(double value, AreaUnit unit) { - if(unit == AreaUnit.Undefined) + if (unit == AreaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -615,8 +615,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Area objArea)) throw new ArgumentException("Expected type Area.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Area objArea)) throw new ArgumentException("Expected type Area.", nameof(obj)); return CompareTo(objArea); } @@ -630,7 +630,7 @@ internal int CompareTo(Area other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Area objArea)) + if (obj is null || !(obj is Area objArea)) return false; return Equals(objArea); @@ -683,7 +683,7 @@ public bool Equals(Area other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Area other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -713,7 +713,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(AreaUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -760,7 +760,7 @@ private double AsBaseUnit() private double AsBaseNumericType(AreaUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.g.cs index 9c77e87bf3..c72d5200e0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.g.cs @@ -79,7 +79,7 @@ public AreaDensity() /// If value is NaN or Infinity. private AreaDensity(double value, AreaDensityUnit unit) { - if(unit == AreaDensityUnit.Undefined) + if (unit == AreaDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -380,8 +380,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AreaDensity objAreaDensity)) throw new ArgumentException("Expected type AreaDensity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is AreaDensity objAreaDensity)) throw new ArgumentException("Expected type AreaDensity.", nameof(obj)); return CompareTo(objAreaDensity); } @@ -395,7 +395,7 @@ internal int CompareTo(AreaDensity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is AreaDensity objAreaDensity)) + if (obj is null || !(obj is AreaDensity objAreaDensity)) return false; return Equals(objAreaDensity); @@ -448,7 +448,7 @@ public bool Equals(AreaDensity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(AreaDensity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -478,7 +478,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(AreaDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -512,7 +512,7 @@ private double AsBaseUnit() private double AsBaseNumericType(AreaDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs index 8fd9a7e4cb..f01639a3c0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -79,7 +79,7 @@ public AreaMomentOfInertia() /// If value is NaN or Infinity. private AreaMomentOfInertia(double value, AreaMomentOfInertiaUnit unit) { - if(unit == AreaMomentOfInertiaUnit.Undefined) + if (unit == AreaMomentOfInertiaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -460,8 +460,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AreaMomentOfInertia objAreaMomentOfInertia)) throw new ArgumentException("Expected type AreaMomentOfInertia.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is AreaMomentOfInertia objAreaMomentOfInertia)) throw new ArgumentException("Expected type AreaMomentOfInertia.", nameof(obj)); return CompareTo(objAreaMomentOfInertia); } @@ -475,7 +475,7 @@ internal int CompareTo(AreaMomentOfInertia other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is AreaMomentOfInertia objAreaMomentOfInertia)) + if (obj is null || !(obj is AreaMomentOfInertia objAreaMomentOfInertia)) return false; return Equals(objAreaMomentOfInertia); @@ -528,7 +528,7 @@ public bool Equals(AreaMomentOfInertia other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(AreaMomentOfInertia other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -558,7 +558,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(AreaMomentOfInertiaUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -597,7 +597,7 @@ private double AsBaseUnit() private double AsBaseNumericType(AreaMomentOfInertiaUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.g.cs index 7248618e84..aa2d0c26ec 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.g.cs @@ -82,7 +82,7 @@ public BitRate() /// If value is NaN or Infinity. private BitRate(decimal value, BitRateUnit unit) { - if(unit == BitRateUnit.Undefined) + if (unit == BitRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = value; @@ -783,8 +783,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is BitRate objBitRate)) throw new ArgumentException("Expected type BitRate.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is BitRate objBitRate)) throw new ArgumentException("Expected type BitRate.", nameof(obj)); return CompareTo(objBitRate); } @@ -798,7 +798,7 @@ internal int CompareTo(BitRate other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is BitRate objBitRate)) + if (obj is null || !(obj is BitRate objBitRate)) return false; return Equals(objBitRate); @@ -851,7 +851,7 @@ public bool Equals(BitRate other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(BitRate other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -881,7 +881,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(BitRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -940,7 +940,7 @@ private decimal AsBaseUnit() private decimal AsBaseNumericType(BitRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs index 04052c206e..7f9958a2b7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -79,7 +79,7 @@ public BrakeSpecificFuelConsumption() /// If value is NaN or Infinity. private BrakeSpecificFuelConsumption(double value, BrakeSpecificFuelConsumptionUnit unit) { - if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) + if (unit == BrakeSpecificFuelConsumptionUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -412,8 +412,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is BrakeSpecificFuelConsumption objBrakeSpecificFuelConsumption)) throw new ArgumentException("Expected type BrakeSpecificFuelConsumption.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is BrakeSpecificFuelConsumption objBrakeSpecificFuelConsumption)) throw new ArgumentException("Expected type BrakeSpecificFuelConsumption.", nameof(obj)); return CompareTo(objBrakeSpecificFuelConsumption); } @@ -427,7 +427,7 @@ internal int CompareTo(BrakeSpecificFuelConsumption other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is BrakeSpecificFuelConsumption objBrakeSpecificFuelConsumption)) + if (obj is null || !(obj is BrakeSpecificFuelConsumption objBrakeSpecificFuelConsumption)) return false; return Equals(objBrakeSpecificFuelConsumption); @@ -480,7 +480,7 @@ public bool Equals(BrakeSpecificFuelConsumption other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(BrakeSpecificFuelConsumption other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -510,7 +510,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(BrakeSpecificFuelConsumptionUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -546,7 +546,7 @@ private double AsBaseUnit() private double AsBaseNumericType(BrakeSpecificFuelConsumptionUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.g.cs index a086ac6d58..1da6d57f5c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.g.cs @@ -82,7 +82,7 @@ public Capacitance() /// If value is NaN or Infinity. private Capacitance(double value, CapacitanceUnit unit) { - if(unit == CapacitanceUnit.Undefined) + if (unit == CapacitanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -479,8 +479,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Capacitance objCapacitance)) throw new ArgumentException("Expected type Capacitance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Capacitance objCapacitance)) throw new ArgumentException("Expected type Capacitance.", nameof(obj)); return CompareTo(objCapacitance); } @@ -494,7 +494,7 @@ internal int CompareTo(Capacitance other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Capacitance objCapacitance)) + if (obj is null || !(obj is Capacitance objCapacitance)) return false; return Equals(objCapacitance); @@ -547,7 +547,7 @@ public bool Equals(Capacitance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Capacitance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -577,7 +577,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(CapacitanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -617,7 +617,7 @@ private double AsBaseUnit() private double AsBaseNumericType(CapacitanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs index f169bcb155..712c920706 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs @@ -79,7 +79,7 @@ public CoefficientOfThermalExpansion() /// If value is NaN or Infinity. private CoefficientOfThermalExpansion(double value, CoefficientOfThermalExpansionUnit unit) { - if(unit == CoefficientOfThermalExpansionUnit.Undefined) + if (unit == CoefficientOfThermalExpansionUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -412,8 +412,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) throw new ArgumentException("Expected type CoefficientOfThermalExpansion.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) throw new ArgumentException("Expected type CoefficientOfThermalExpansion.", nameof(obj)); return CompareTo(objCoefficientOfThermalExpansion); } @@ -427,7 +427,7 @@ internal int CompareTo(CoefficientOfThermalExpansion other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) + if (obj is null || !(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) return false; return Equals(objCoefficientOfThermalExpansion); @@ -480,7 +480,7 @@ public bool Equals(CoefficientOfThermalExpansion other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(CoefficientOfThermalExpansion other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -510,7 +510,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(CoefficientOfThermalExpansionUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -546,7 +546,7 @@ private double AsBaseUnit() private double AsBaseNumericType(CoefficientOfThermalExpansionUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.g.cs index 9bc16262fe..4066d43b14 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.g.cs @@ -82,7 +82,7 @@ public Density() /// If value is NaN or Infinity. private Density(double value, DensityUnit unit) { - if(unit == DensityUnit.Undefined) + if (unit == DensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -1187,8 +1187,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Density objDensity)) throw new ArgumentException("Expected type Density.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Density objDensity)) throw new ArgumentException("Expected type Density.", nameof(obj)); return CompareTo(objDensity); } @@ -1202,7 +1202,7 @@ internal int CompareTo(Density other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Density objDensity)) + if (obj is null || !(obj is Density objDensity)) return false; return Equals(objDensity); @@ -1255,7 +1255,7 @@ public bool Equals(Density other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Density other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1285,7 +1285,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(DensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -1369,7 +1369,7 @@ private double AsBaseUnit() private double AsBaseNumericType(DensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.g.cs index c481f67e3b..748f863acc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.g.cs @@ -79,7 +79,7 @@ public Duration() /// If value is NaN or Infinity. private Duration(double value, DurationUnit unit) { - if(unit == DurationUnit.Undefined) + if (unit == DurationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -550,8 +550,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Duration objDuration)) throw new ArgumentException("Expected type Duration.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Duration objDuration)) throw new ArgumentException("Expected type Duration.", nameof(obj)); return CompareTo(objDuration); } @@ -565,7 +565,7 @@ internal int CompareTo(Duration other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Duration objDuration)) + if (obj is null || !(obj is Duration objDuration)) return false; return Equals(objDuration); @@ -618,7 +618,7 @@ public bool Equals(Duration other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Duration other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -648,7 +648,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(DurationUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -692,7 +692,7 @@ private double AsBaseUnit() private double AsBaseNumericType(DurationUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.g.cs index 7faaa6bf8d..2a68b8471c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -82,7 +82,7 @@ public DynamicViscosity() /// If value is NaN or Infinity. private DynamicViscosity(double value, DynamicViscosityUnit unit) { - if(unit == DynamicViscosityUnit.Undefined) + if (unit == DynamicViscosityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -527,8 +527,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is DynamicViscosity objDynamicViscosity)) throw new ArgumentException("Expected type DynamicViscosity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is DynamicViscosity objDynamicViscosity)) throw new ArgumentException("Expected type DynamicViscosity.", nameof(obj)); return CompareTo(objDynamicViscosity); } @@ -542,7 +542,7 @@ internal int CompareTo(DynamicViscosity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is DynamicViscosity objDynamicViscosity)) + if (obj is null || !(obj is DynamicViscosity objDynamicViscosity)) return false; return Equals(objDynamicViscosity); @@ -595,7 +595,7 @@ public bool Equals(DynamicViscosity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(DynamicViscosity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -625,7 +625,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(DynamicViscosityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -668,7 +668,7 @@ private double AsBaseUnit() private double AsBaseNumericType(DynamicViscosityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.g.cs index 61a16a352e..76fac0e7f9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.g.cs @@ -79,7 +79,7 @@ public ElectricAdmittance() /// If value is NaN or Infinity. private ElectricAdmittance(double value, ElectricAdmittanceUnit unit) { - if(unit == ElectricAdmittanceUnit.Undefined) + if (unit == ElectricAdmittanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -428,8 +428,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricAdmittance objElectricAdmittance)) throw new ArgumentException("Expected type ElectricAdmittance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricAdmittance objElectricAdmittance)) throw new ArgumentException("Expected type ElectricAdmittance.", nameof(obj)); return CompareTo(objElectricAdmittance); } @@ -443,7 +443,7 @@ internal int CompareTo(ElectricAdmittance other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricAdmittance objElectricAdmittance)) + if (obj is null || !(obj is ElectricAdmittance objElectricAdmittance)) return false; return Equals(objElectricAdmittance); @@ -496,7 +496,7 @@ public bool Equals(ElectricAdmittance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricAdmittance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -526,7 +526,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricAdmittanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -563,7 +563,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricAdmittanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.g.cs index e092fa9641..c9f0006a12 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -82,7 +82,7 @@ public ElectricCharge() /// If value is NaN or Infinity. private ElectricCharge(double value, ElectricChargeUnit unit) { - if(unit == ElectricChargeUnit.Undefined) + if (unit == ElectricChargeUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -447,8 +447,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCharge objElectricCharge)) throw new ArgumentException("Expected type ElectricCharge.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricCharge objElectricCharge)) throw new ArgumentException("Expected type ElectricCharge.", nameof(obj)); return CompareTo(objElectricCharge); } @@ -462,7 +462,7 @@ internal int CompareTo(ElectricCharge other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricCharge objElectricCharge)) + if (obj is null || !(obj is ElectricCharge objElectricCharge)) return false; return Equals(objElectricCharge); @@ -515,7 +515,7 @@ public bool Equals(ElectricCharge other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricCharge other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -545,7 +545,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricChargeUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -583,7 +583,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricChargeUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.g.cs index 7b7a210d15..a4ed970869 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.g.cs @@ -82,7 +82,7 @@ public ElectricChargeDensity() /// If value is NaN or Infinity. private ElectricChargeDensity(double value, ElectricChargeDensityUnit unit) { - if(unit == ElectricChargeDensityUnit.Undefined) + if (unit == ElectricChargeDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -383,8 +383,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricChargeDensity objElectricChargeDensity)) throw new ArgumentException("Expected type ElectricChargeDensity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricChargeDensity objElectricChargeDensity)) throw new ArgumentException("Expected type ElectricChargeDensity.", nameof(obj)); return CompareTo(objElectricChargeDensity); } @@ -398,7 +398,7 @@ internal int CompareTo(ElectricChargeDensity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricChargeDensity objElectricChargeDensity)) + if (obj is null || !(obj is ElectricChargeDensity objElectricChargeDensity)) return false; return Equals(objElectricChargeDensity); @@ -451,7 +451,7 @@ public bool Equals(ElectricChargeDensity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricChargeDensity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -481,7 +481,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricChargeDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -515,7 +515,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricChargeDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.g.cs index e7eb2634a5..18170930a2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.g.cs @@ -82,7 +82,7 @@ public ElectricConductance() /// If value is NaN or Infinity. private ElectricConductance(double value, ElectricConductanceUnit unit) { - if(unit == ElectricConductanceUnit.Undefined) + if (unit == ElectricConductanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -415,8 +415,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricConductance objElectricConductance)) throw new ArgumentException("Expected type ElectricConductance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricConductance objElectricConductance)) throw new ArgumentException("Expected type ElectricConductance.", nameof(obj)); return CompareTo(objElectricConductance); } @@ -430,7 +430,7 @@ internal int CompareTo(ElectricConductance other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricConductance objElectricConductance)) + if (obj is null || !(obj is ElectricConductance objElectricConductance)) return false; return Equals(objElectricConductance); @@ -483,7 +483,7 @@ public bool Equals(ElectricConductance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricConductance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -513,7 +513,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricConductanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -549,7 +549,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricConductanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.g.cs index 3ea7d1d85f..4cecee9fc7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -82,7 +82,7 @@ public ElectricConductivity() /// If value is NaN or Infinity. private ElectricConductivity(double value, ElectricConductivityUnit unit) { - if(unit == ElectricConductivityUnit.Undefined) + if (unit == ElectricConductivityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -415,8 +415,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricConductivity objElectricConductivity)) throw new ArgumentException("Expected type ElectricConductivity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricConductivity objElectricConductivity)) throw new ArgumentException("Expected type ElectricConductivity.", nameof(obj)); return CompareTo(objElectricConductivity); } @@ -430,7 +430,7 @@ internal int CompareTo(ElectricConductivity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricConductivity objElectricConductivity)) + if (obj is null || !(obj is ElectricConductivity objElectricConductivity)) return false; return Equals(objElectricConductivity); @@ -483,7 +483,7 @@ public bool Equals(ElectricConductivity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricConductivity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -513,7 +513,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricConductivityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -549,7 +549,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricConductivityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.g.cs index 9602fc23f2..09132bc003 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -79,7 +79,7 @@ public ElectricCurrent() /// If value is NaN or Infinity. private ElectricCurrent(double value, ElectricCurrentUnit unit) { - if(unit == ElectricCurrentUnit.Undefined) + if (unit == ElectricCurrentUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -492,8 +492,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrent objElectricCurrent)) throw new ArgumentException("Expected type ElectricCurrent.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricCurrent objElectricCurrent)) throw new ArgumentException("Expected type ElectricCurrent.", nameof(obj)); return CompareTo(objElectricCurrent); } @@ -507,7 +507,7 @@ internal int CompareTo(ElectricCurrent other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricCurrent objElectricCurrent)) + if (obj is null || !(obj is ElectricCurrent objElectricCurrent)) return false; return Equals(objElectricCurrent); @@ -560,7 +560,7 @@ public bool Equals(ElectricCurrent other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricCurrent other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -590,7 +590,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricCurrentUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -631,7 +631,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricCurrentUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs index 7c45fe1e2b..b99fd8e071 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs @@ -82,7 +82,7 @@ public ElectricCurrentDensity() /// If value is NaN or Infinity. private ElectricCurrentDensity(double value, ElectricCurrentDensityUnit unit) { - if(unit == ElectricCurrentDensityUnit.Undefined) + if (unit == ElectricCurrentDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -415,8 +415,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrentDensity objElectricCurrentDensity)) throw new ArgumentException("Expected type ElectricCurrentDensity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricCurrentDensity objElectricCurrentDensity)) throw new ArgumentException("Expected type ElectricCurrentDensity.", nameof(obj)); return CompareTo(objElectricCurrentDensity); } @@ -430,7 +430,7 @@ internal int CompareTo(ElectricCurrentDensity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricCurrentDensity objElectricCurrentDensity)) + if (obj is null || !(obj is ElectricCurrentDensity objElectricCurrentDensity)) return false; return Equals(objElectricCurrentDensity); @@ -483,7 +483,7 @@ public bool Equals(ElectricCurrentDensity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricCurrentDensity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -513,7 +513,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricCurrentDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -549,7 +549,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricCurrentDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs index d0c10c1a34..05cd6a8e47 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -79,7 +79,7 @@ public ElectricCurrentGradient() /// If value is NaN or Infinity. private ElectricCurrentGradient(double value, ElectricCurrentGradientUnit unit) { - if(unit == ElectricCurrentGradientUnit.Undefined) + if (unit == ElectricCurrentGradientUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -428,8 +428,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrentGradient objElectricCurrentGradient)) throw new ArgumentException("Expected type ElectricCurrentGradient.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricCurrentGradient objElectricCurrentGradient)) throw new ArgumentException("Expected type ElectricCurrentGradient.", nameof(obj)); return CompareTo(objElectricCurrentGradient); } @@ -443,7 +443,7 @@ internal int CompareTo(ElectricCurrentGradient other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricCurrentGradient objElectricCurrentGradient)) + if (obj is null || !(obj is ElectricCurrentGradient objElectricCurrentGradient)) return false; return Equals(objElectricCurrentGradient); @@ -496,7 +496,7 @@ public bool Equals(ElectricCurrentGradient other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricCurrentGradient other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -526,7 +526,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricCurrentGradientUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -563,7 +563,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricCurrentGradientUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.g.cs index 243819e936..c7d35225a9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.g.cs @@ -82,7 +82,7 @@ public ElectricField() /// If value is NaN or Infinity. private ElectricField(double value, ElectricFieldUnit unit) { - if(unit == ElectricFieldUnit.Undefined) + if (unit == ElectricFieldUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -383,8 +383,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricField objElectricField)) throw new ArgumentException("Expected type ElectricField.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricField objElectricField)) throw new ArgumentException("Expected type ElectricField.", nameof(obj)); return CompareTo(objElectricField); } @@ -398,7 +398,7 @@ internal int CompareTo(ElectricField other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricField objElectricField)) + if (obj is null || !(obj is ElectricField objElectricField)) return false; return Equals(objElectricField); @@ -451,7 +451,7 @@ public bool Equals(ElectricField other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricField other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -481,7 +481,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricFieldUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -515,7 +515,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricFieldUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.g.cs index 6d8334d60a..a3b6f3ddcc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.g.cs @@ -82,7 +82,7 @@ public ElectricInductance() /// If value is NaN or Infinity. private ElectricInductance(double value, ElectricInductanceUnit unit) { - if(unit == ElectricInductanceUnit.Undefined) + if (unit == ElectricInductanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -431,8 +431,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricInductance objElectricInductance)) throw new ArgumentException("Expected type ElectricInductance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricInductance objElectricInductance)) throw new ArgumentException("Expected type ElectricInductance.", nameof(obj)); return CompareTo(objElectricInductance); } @@ -446,7 +446,7 @@ internal int CompareTo(ElectricInductance other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricInductance objElectricInductance)) + if (obj is null || !(obj is ElectricInductance objElectricInductance)) return false; return Equals(objElectricInductance); @@ -499,7 +499,7 @@ public bool Equals(ElectricInductance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricInductance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -529,7 +529,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricInductanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -566,7 +566,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricInductanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.g.cs index 93b1752742..4e2c70fdd9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -79,7 +79,7 @@ public ElectricPotential() /// If value is NaN or Infinity. private ElectricPotential(double value, ElectricPotentialUnit unit) { - if(unit == ElectricPotentialUnit.Undefined) + if (unit == ElectricPotentialUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -449,8 +449,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotential objElectricPotential)) throw new ArgumentException("Expected type ElectricPotential.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricPotential objElectricPotential)) throw new ArgumentException("Expected type ElectricPotential.", nameof(obj)); return CompareTo(objElectricPotential); } @@ -464,7 +464,7 @@ internal int CompareTo(ElectricPotential other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricPotential objElectricPotential)) + if (obj is null || !(obj is ElectricPotential objElectricPotential)) return false; return Equals(objElectricPotential); @@ -517,7 +517,7 @@ public bool Equals(ElectricPotential other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricPotential other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -547,7 +547,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricPotentialUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -585,7 +585,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricPotentialUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.g.cs index 1ea4bca0bb..8fe74e476a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.g.cs @@ -79,7 +79,7 @@ public ElectricPotentialAc() /// If value is NaN or Infinity. private ElectricPotentialAc(double value, ElectricPotentialAcUnit unit) { - if(unit == ElectricPotentialAcUnit.Undefined) + if (unit == ElectricPotentialAcUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -444,8 +444,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotentialAc objElectricPotentialAc)) throw new ArgumentException("Expected type ElectricPotentialAc.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricPotentialAc objElectricPotentialAc)) throw new ArgumentException("Expected type ElectricPotentialAc.", nameof(obj)); return CompareTo(objElectricPotentialAc); } @@ -459,7 +459,7 @@ internal int CompareTo(ElectricPotentialAc other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricPotentialAc objElectricPotentialAc)) + if (obj is null || !(obj is ElectricPotentialAc objElectricPotentialAc)) return false; return Equals(objElectricPotentialAc); @@ -512,7 +512,7 @@ public bool Equals(ElectricPotentialAc other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricPotentialAc other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -542,7 +542,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricPotentialAcUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -580,7 +580,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricPotentialAcUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs index 9d50b7f9fc..65163f2172 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs @@ -79,7 +79,7 @@ public ElectricPotentialChangeRate() /// If value is NaN or Infinity. private ElectricPotentialChangeRate(double value, ElectricPotentialChangeRateUnit unit) { - if(unit == ElectricPotentialChangeRateUnit.Undefined) + if (unit == ElectricPotentialChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -684,8 +684,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotentialChangeRate objElectricPotentialChangeRate)) throw new ArgumentException("Expected type ElectricPotentialChangeRate.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricPotentialChangeRate objElectricPotentialChangeRate)) throw new ArgumentException("Expected type ElectricPotentialChangeRate.", nameof(obj)); return CompareTo(objElectricPotentialChangeRate); } @@ -699,7 +699,7 @@ internal int CompareTo(ElectricPotentialChangeRate other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricPotentialChangeRate objElectricPotentialChangeRate)) + if (obj is null || !(obj is ElectricPotentialChangeRate objElectricPotentialChangeRate)) return false; return Equals(objElectricPotentialChangeRate); @@ -752,7 +752,7 @@ public bool Equals(ElectricPotentialChangeRate other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricPotentialChangeRate other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -782,7 +782,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricPotentialChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -835,7 +835,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricPotentialChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.g.cs index e09f59ea6d..e01e682d9f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.g.cs @@ -79,7 +79,7 @@ public ElectricPotentialDc() /// If value is NaN or Infinity. private ElectricPotentialDc(double value, ElectricPotentialDcUnit unit) { - if(unit == ElectricPotentialDcUnit.Undefined) + if (unit == ElectricPotentialDcUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -444,8 +444,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotentialDc objElectricPotentialDc)) throw new ArgumentException("Expected type ElectricPotentialDc.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricPotentialDc objElectricPotentialDc)) throw new ArgumentException("Expected type ElectricPotentialDc.", nameof(obj)); return CompareTo(objElectricPotentialDc); } @@ -459,7 +459,7 @@ internal int CompareTo(ElectricPotentialDc other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricPotentialDc objElectricPotentialDc)) + if (obj is null || !(obj is ElectricPotentialDc objElectricPotentialDc)) return false; return Equals(objElectricPotentialDc); @@ -512,7 +512,7 @@ public bool Equals(ElectricPotentialDc other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricPotentialDc other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -542,7 +542,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricPotentialDcUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -580,7 +580,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricPotentialDcUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.g.cs index 18f99504f2..64bae0a218 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -79,7 +79,7 @@ public ElectricResistance() /// If value is NaN or Infinity. private ElectricResistance(double value, ElectricResistanceUnit unit) { - if(unit == ElectricResistanceUnit.Undefined) + if (unit == ElectricResistanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -460,8 +460,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricResistance objElectricResistance)) throw new ArgumentException("Expected type ElectricResistance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricResistance objElectricResistance)) throw new ArgumentException("Expected type ElectricResistance.", nameof(obj)); return CompareTo(objElectricResistance); } @@ -475,7 +475,7 @@ internal int CompareTo(ElectricResistance other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricResistance objElectricResistance)) + if (obj is null || !(obj is ElectricResistance objElectricResistance)) return false; return Equals(objElectricResistance); @@ -528,7 +528,7 @@ public bool Equals(ElectricResistance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricResistance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -558,7 +558,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricResistanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -597,7 +597,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricResistanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.g.cs index 9bad434fed..5f94366019 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -82,7 +82,7 @@ public ElectricResistivity() /// If value is NaN or Infinity. private ElectricResistivity(double value, ElectricResistivityUnit unit) { - if(unit == ElectricResistivityUnit.Undefined) + if (unit == ElectricResistivityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -591,8 +591,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricResistivity objElectricResistivity)) throw new ArgumentException("Expected type ElectricResistivity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricResistivity objElectricResistivity)) throw new ArgumentException("Expected type ElectricResistivity.", nameof(obj)); return CompareTo(objElectricResistivity); } @@ -606,7 +606,7 @@ internal int CompareTo(ElectricResistivity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricResistivity objElectricResistivity)) + if (obj is null || !(obj is ElectricResistivity objElectricResistivity)) return false; return Equals(objElectricResistivity); @@ -659,7 +659,7 @@ public bool Equals(ElectricResistivity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricResistivity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -689,7 +689,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricResistivityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -736,7 +736,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricResistivityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs index b1f9c966e2..3fdda10e7e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs @@ -82,7 +82,7 @@ public ElectricSurfaceChargeDensity() /// If value is NaN or Infinity. private ElectricSurfaceChargeDensity(double value, ElectricSurfaceChargeDensityUnit unit) { - if(unit == ElectricSurfaceChargeDensityUnit.Undefined) + if (unit == ElectricSurfaceChargeDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -415,8 +415,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricSurfaceChargeDensity objElectricSurfaceChargeDensity)) throw new ArgumentException("Expected type ElectricSurfaceChargeDensity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricSurfaceChargeDensity objElectricSurfaceChargeDensity)) throw new ArgumentException("Expected type ElectricSurfaceChargeDensity.", nameof(obj)); return CompareTo(objElectricSurfaceChargeDensity); } @@ -430,7 +430,7 @@ internal int CompareTo(ElectricSurfaceChargeDensity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricSurfaceChargeDensity objElectricSurfaceChargeDensity)) + if (obj is null || !(obj is ElectricSurfaceChargeDensity objElectricSurfaceChargeDensity)) return false; return Equals(objElectricSurfaceChargeDensity); @@ -483,7 +483,7 @@ public bool Equals(ElectricSurfaceChargeDensity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricSurfaceChargeDensity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -513,7 +513,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricSurfaceChargeDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -549,7 +549,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ElectricSurfaceChargeDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.g.cs index 1def1787c0..b69e8f63ee 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.g.cs @@ -79,7 +79,7 @@ public Energy() /// If value is NaN or Infinity. private Energy(double value, EnergyUnit unit) { - if(unit == EnergyUnit.Undefined) + if (unit == EnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -961,8 +961,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Energy objEnergy)) throw new ArgumentException("Expected type Energy.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Energy objEnergy)) throw new ArgumentException("Expected type Energy.", nameof(obj)); return CompareTo(objEnergy); } @@ -976,7 +976,7 @@ internal int CompareTo(Energy other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Energy objEnergy)) + if (obj is null || !(obj is Energy objEnergy)) return false; return Equals(objEnergy); @@ -1029,7 +1029,7 @@ public bool Equals(Energy other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Energy other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1059,7 +1059,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(EnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -1128,7 +1128,7 @@ private double AsBaseUnit() private double AsBaseNumericType(EnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.g.cs index de0ee5d49f..59197b186c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.g.cs @@ -79,7 +79,7 @@ public Entropy() /// If value is NaN or Infinity. private Entropy(double value, EntropyUnit unit) { - if(unit == EntropyUnit.Undefined) + if (unit == EntropyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -476,8 +476,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Entropy objEntropy)) throw new ArgumentException("Expected type Entropy.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Entropy objEntropy)) throw new ArgumentException("Expected type Entropy.", nameof(obj)); return CompareTo(objEntropy); } @@ -491,7 +491,7 @@ internal int CompareTo(Entropy other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Entropy objEntropy)) + if (obj is null || !(obj is Entropy objEntropy)) return false; return Equals(objEntropy); @@ -544,7 +544,7 @@ public bool Equals(Entropy other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Entropy other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -574,7 +574,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(EntropyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -614,7 +614,7 @@ private double AsBaseUnit() private double AsBaseNumericType(EntropyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.g.cs index 599cf7efb7..b368cc83ae 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.g.cs @@ -79,7 +79,7 @@ public Force() /// If value is NaN or Infinity. private Force(double value, ForceUnit unit) { - if(unit == ForceUnit.Undefined) + if (unit == ForceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -617,8 +617,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Force objForce)) throw new ArgumentException("Expected type Force.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Force objForce)) throw new ArgumentException("Expected type Force.", nameof(obj)); return CompareTo(objForce); } @@ -632,7 +632,7 @@ internal int CompareTo(Force other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Force objForce)) + if (obj is null || !(obj is Force objForce)) return false; return Equals(objForce); @@ -685,7 +685,7 @@ public bool Equals(Force other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Force other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -715,7 +715,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ForceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -763,7 +763,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ForceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.g.cs index 51dafc2c21..82e40e5171 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -79,7 +79,7 @@ public ForceChangeRate() /// If value is NaN or Infinity. private ForceChangeRate(double value, ForceChangeRateUnit unit) { - if(unit == ForceChangeRateUnit.Undefined) + if (unit == ForceChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -604,8 +604,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ForceChangeRate objForceChangeRate)) throw new ArgumentException("Expected type ForceChangeRate.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ForceChangeRate objForceChangeRate)) throw new ArgumentException("Expected type ForceChangeRate.", nameof(obj)); return CompareTo(objForceChangeRate); } @@ -619,7 +619,7 @@ internal int CompareTo(ForceChangeRate other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ForceChangeRate objForceChangeRate)) + if (obj is null || !(obj is ForceChangeRate objForceChangeRate)) return false; return Equals(objForceChangeRate); @@ -672,7 +672,7 @@ public bool Equals(ForceChangeRate other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ForceChangeRate other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -702,7 +702,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ForceChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -750,7 +750,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ForceChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.g.cs index 502f06c85c..c59847920d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -79,7 +79,7 @@ public ForcePerLength() /// If value is NaN or Infinity. private ForcePerLength(double value, ForcePerLengthUnit unit) { - if(unit == ForcePerLengthUnit.Undefined) + if (unit == ForcePerLengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -978,8 +978,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ForcePerLength objForcePerLength)) throw new ArgumentException("Expected type ForcePerLength.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ForcePerLength objForcePerLength)) throw new ArgumentException("Expected type ForcePerLength.", nameof(obj)); return CompareTo(objForcePerLength); } @@ -993,7 +993,7 @@ internal int CompareTo(ForcePerLength other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ForcePerLength objForcePerLength)) + if (obj is null || !(obj is ForcePerLength objForcePerLength)) return false; return Equals(objForcePerLength); @@ -1046,7 +1046,7 @@ public bool Equals(ForcePerLength other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ForcePerLength other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1076,7 +1076,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ForcePerLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -1147,7 +1147,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ForcePerLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.g.cs index e9c04d802a..76ed379bab 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.g.cs @@ -79,7 +79,7 @@ public Frequency() /// If value is NaN or Infinity. private Frequency(double value, FrequencyUnit unit) { - if(unit == FrequencyUnit.Undefined) + if (unit == FrequencyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -547,8 +547,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Frequency objFrequency)) throw new ArgumentException("Expected type Frequency.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Frequency objFrequency)) throw new ArgumentException("Expected type Frequency.", nameof(obj)); return CompareTo(objFrequency); } @@ -562,7 +562,7 @@ internal int CompareTo(Frequency other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Frequency objFrequency)) + if (obj is null || !(obj is Frequency objFrequency)) return false; return Equals(objFrequency); @@ -615,7 +615,7 @@ public bool Equals(Frequency other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Frequency other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -645,7 +645,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(FrequencyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -689,7 +689,7 @@ private double AsBaseUnit() private double AsBaseNumericType(FrequencyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/FuelEfficiency.g.cs index 33b2402ae8..b8a6894b21 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/FuelEfficiency.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/FuelEfficiency.g.cs @@ -82,7 +82,7 @@ public FuelEfficiency() /// If value is NaN or Infinity. private FuelEfficiency(double value, FuelEfficiencyUnit unit) { - if(unit == FuelEfficiencyUnit.Undefined) + if (unit == FuelEfficiencyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -431,8 +431,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is FuelEfficiency objFuelEfficiency)) throw new ArgumentException("Expected type FuelEfficiency.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is FuelEfficiency objFuelEfficiency)) throw new ArgumentException("Expected type FuelEfficiency.", nameof(obj)); return CompareTo(objFuelEfficiency); } @@ -446,7 +446,7 @@ internal int CompareTo(FuelEfficiency other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is FuelEfficiency objFuelEfficiency)) + if (obj is null || !(obj is FuelEfficiency objFuelEfficiency)) return false; return Equals(objFuelEfficiency); @@ -499,7 +499,7 @@ public bool Equals(FuelEfficiency other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(FuelEfficiency other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -529,7 +529,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(FuelEfficiencyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -566,7 +566,7 @@ private double AsBaseUnit() private double AsBaseNumericType(FuelEfficiencyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.g.cs index 2543ee252b..f31984572f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.g.cs @@ -79,7 +79,7 @@ public HeatFlux() /// If value is NaN or Infinity. private HeatFlux(double value, HeatFluxUnit unit) { - if(unit == HeatFluxUnit.Undefined) + if (unit == HeatFluxUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -652,8 +652,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is HeatFlux objHeatFlux)) throw new ArgumentException("Expected type HeatFlux.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is HeatFlux objHeatFlux)) throw new ArgumentException("Expected type HeatFlux.", nameof(obj)); return CompareTo(objHeatFlux); } @@ -667,7 +667,7 @@ internal int CompareTo(HeatFlux other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is HeatFlux objHeatFlux)) + if (obj is null || !(obj is HeatFlux objHeatFlux)) return false; return Equals(objHeatFlux); @@ -720,7 +720,7 @@ public bool Equals(HeatFlux other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(HeatFlux other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -750,7 +750,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(HeatFluxUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -801,7 +801,7 @@ private double AsBaseUnit() private double AsBaseNumericType(HeatFluxUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs index 29965ba0da..6901ee1373 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs @@ -79,7 +79,7 @@ public HeatTransferCoefficient() /// If value is NaN or Infinity. private HeatTransferCoefficient(double value, HeatTransferCoefficientUnit unit) { - if(unit == HeatTransferCoefficientUnit.Undefined) + if (unit == HeatTransferCoefficientUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -412,8 +412,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is HeatTransferCoefficient objHeatTransferCoefficient)) throw new ArgumentException("Expected type HeatTransferCoefficient.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is HeatTransferCoefficient objHeatTransferCoefficient)) throw new ArgumentException("Expected type HeatTransferCoefficient.", nameof(obj)); return CompareTo(objHeatTransferCoefficient); } @@ -427,7 +427,7 @@ internal int CompareTo(HeatTransferCoefficient other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is HeatTransferCoefficient objHeatTransferCoefficient)) + if (obj is null || !(obj is HeatTransferCoefficient objHeatTransferCoefficient)) return false; return Equals(objHeatTransferCoefficient); @@ -480,7 +480,7 @@ public bool Equals(HeatTransferCoefficient other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(HeatTransferCoefficient other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -510,7 +510,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(HeatTransferCoefficientUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -546,7 +546,7 @@ private double AsBaseUnit() private double AsBaseNumericType(HeatTransferCoefficientUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.g.cs index 5da1ef60e2..b037bcf11a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.g.cs @@ -82,7 +82,7 @@ public Illuminance() /// If value is NaN or Infinity. private Illuminance(double value, IlluminanceUnit unit) { - if(unit == IlluminanceUnit.Undefined) + if (unit == IlluminanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -431,8 +431,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Illuminance objIlluminance)) throw new ArgumentException("Expected type Illuminance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Illuminance objIlluminance)) throw new ArgumentException("Expected type Illuminance.", nameof(obj)); return CompareTo(objIlluminance); } @@ -446,7 +446,7 @@ internal int CompareTo(Illuminance other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Illuminance objIlluminance)) + if (obj is null || !(obj is Illuminance objIlluminance)) return false; return Equals(objIlluminance); @@ -499,7 +499,7 @@ public bool Equals(Illuminance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Illuminance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -529,7 +529,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(IlluminanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -566,7 +566,7 @@ private double AsBaseUnit() private double AsBaseNumericType(IlluminanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.g.cs index 0551158d10..118f1ba385 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.g.cs @@ -79,7 +79,7 @@ public Information() /// If value is NaN or Infinity. private Information(decimal value, InformationUnit unit) { - if(unit == InformationUnit.Undefined) + if (unit == InformationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = value; @@ -780,8 +780,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Information objInformation)) throw new ArgumentException("Expected type Information.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Information objInformation)) throw new ArgumentException("Expected type Information.", nameof(obj)); return CompareTo(objInformation); } @@ -795,7 +795,7 @@ internal int CompareTo(Information other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Information objInformation)) + if (obj is null || !(obj is Information objInformation)) return false; return Equals(objInformation); @@ -848,7 +848,7 @@ public bool Equals(Information other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Information other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -878,7 +878,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(InformationUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -937,7 +937,7 @@ private decimal AsBaseUnit() private decimal AsBaseNumericType(InformationUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.g.cs index b5cff3e612..4e12065dcb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.g.cs @@ -79,7 +79,7 @@ public Irradiance() /// If value is NaN or Infinity. private Irradiance(double value, IrradianceUnit unit) { - if(unit == IrradianceUnit.Undefined) + if (unit == IrradianceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -588,8 +588,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Irradiance objIrradiance)) throw new ArgumentException("Expected type Irradiance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Irradiance objIrradiance)) throw new ArgumentException("Expected type Irradiance.", nameof(obj)); return CompareTo(objIrradiance); } @@ -603,7 +603,7 @@ internal int CompareTo(Irradiance other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Irradiance objIrradiance)) + if (obj is null || !(obj is Irradiance objIrradiance)) return false; return Equals(objIrradiance); @@ -656,7 +656,7 @@ public bool Equals(Irradiance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Irradiance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -686,7 +686,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(IrradianceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -733,7 +733,7 @@ private double AsBaseUnit() private double AsBaseNumericType(IrradianceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.g.cs index 7f9cc1dd60..6263c3c9ab 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.g.cs @@ -82,7 +82,7 @@ public Irradiation() /// If value is NaN or Infinity. private Irradiation(double value, IrradiationUnit unit) { - if(unit == IrradiationUnit.Undefined) + if (unit == IrradiationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -479,8 +479,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Irradiation objIrradiation)) throw new ArgumentException("Expected type Irradiation.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Irradiation objIrradiation)) throw new ArgumentException("Expected type Irradiation.", nameof(obj)); return CompareTo(objIrradiation); } @@ -494,7 +494,7 @@ internal int CompareTo(Irradiation other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Irradiation objIrradiation)) + if (obj is null || !(obj is Irradiation objIrradiation)) return false; return Equals(objIrradiation); @@ -547,7 +547,7 @@ public bool Equals(Irradiation other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Irradiation other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -577,7 +577,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(IrradiationUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -617,7 +617,7 @@ private double AsBaseUnit() private double AsBaseNumericType(IrradiationUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.g.cs index ee4b780f81..023f2c98c6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -82,7 +82,7 @@ public KinematicViscosity() /// If value is NaN or Infinity. private KinematicViscosity(double value, KinematicViscosityUnit unit) { - if(unit == KinematicViscosityUnit.Undefined) + if (unit == KinematicViscosityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -519,8 +519,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is KinematicViscosity objKinematicViscosity)) throw new ArgumentException("Expected type KinematicViscosity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is KinematicViscosity objKinematicViscosity)) throw new ArgumentException("Expected type KinematicViscosity.", nameof(obj)); return CompareTo(objKinematicViscosity); } @@ -534,7 +534,7 @@ internal int CompareTo(KinematicViscosity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is KinematicViscosity objKinematicViscosity)) + if (obj is null || !(obj is KinematicViscosity objKinematicViscosity)) return false; return Equals(objKinematicViscosity); @@ -587,7 +587,7 @@ public bool Equals(KinematicViscosity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(KinematicViscosity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -617,7 +617,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(KinematicViscosityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -659,7 +659,7 @@ private double AsBaseUnit() private double AsBaseNumericType(KinematicViscosityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.g.cs index 095cd321d6..583b6939cd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.g.cs @@ -80,7 +80,7 @@ public LapseRate() /// If value is NaN or Infinity. private LapseRate(double value, LapseRateUnit unit) { - if(unit == LapseRateUnit.Undefined) + if (unit == LapseRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -381,8 +381,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LapseRate objLapseRate)) throw new ArgumentException("Expected type LapseRate.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is LapseRate objLapseRate)) throw new ArgumentException("Expected type LapseRate.", nameof(obj)); return CompareTo(objLapseRate); } @@ -396,7 +396,7 @@ internal int CompareTo(LapseRate other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is LapseRate objLapseRate)) + if (obj is null || !(obj is LapseRate objLapseRate)) return false; return Equals(objLapseRate); @@ -449,7 +449,7 @@ public bool Equals(LapseRate other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(LapseRate other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -479,7 +479,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(LapseRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -513,7 +513,7 @@ private double AsBaseUnit() private double AsBaseNumericType(LapseRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.g.cs index f760e764c2..38593d86f6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.g.cs @@ -79,7 +79,7 @@ public Length() /// If value is NaN or Infinity. private Length(double value, LengthUnit unit) { - if(unit == LengthUnit.Undefined) + if (unit == LengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -922,8 +922,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Length objLength)) throw new ArgumentException("Expected type Length.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Length objLength)) throw new ArgumentException("Expected type Length.", nameof(obj)); return CompareTo(objLength); } @@ -937,7 +937,7 @@ internal int CompareTo(Length other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Length objLength)) + if (obj is null || !(obj is Length objLength)) return false; return Equals(objLength); @@ -990,7 +990,7 @@ public bool Equals(Length other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Length other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1020,7 +1020,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(LengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -1086,7 +1086,7 @@ private double AsBaseUnit() private double AsBaseNumericType(LengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.g.cs index c1dfb4b33b..f51affbb8a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.g.cs @@ -79,7 +79,7 @@ public Level() /// If value is NaN or Infinity. private Level(double value, LevelUnit unit) { - if(unit == LevelUnit.Undefined) + if (unit == LevelUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -396,8 +396,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Level objLevel)) throw new ArgumentException("Expected type Level.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Level objLevel)) throw new ArgumentException("Expected type Level.", nameof(obj)); return CompareTo(objLevel); } @@ -411,7 +411,7 @@ internal int CompareTo(Level other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Level objLevel)) + if (obj is null || !(obj is Level objLevel)) return false; return Equals(objLevel); @@ -464,7 +464,7 @@ public bool Equals(Level other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Level other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -494,7 +494,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(LevelUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -529,7 +529,7 @@ private double AsBaseUnit() private double AsBaseNumericType(LevelUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.g.cs index d9fa9b00b1..fd7f33f0bd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.g.cs @@ -82,7 +82,7 @@ public LinearDensity() /// If value is NaN or Infinity. private LinearDensity(double value, LinearDensityUnit unit) { - if(unit == LinearDensityUnit.Undefined) + if (unit == LinearDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -591,8 +591,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LinearDensity objLinearDensity)) throw new ArgumentException("Expected type LinearDensity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is LinearDensity objLinearDensity)) throw new ArgumentException("Expected type LinearDensity.", nameof(obj)); return CompareTo(objLinearDensity); } @@ -606,7 +606,7 @@ internal int CompareTo(LinearDensity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is LinearDensity objLinearDensity)) + if (obj is null || !(obj is LinearDensity objLinearDensity)) return false; return Equals(objLinearDensity); @@ -659,7 +659,7 @@ public bool Equals(LinearDensity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(LinearDensity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -689,7 +689,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(LinearDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -736,7 +736,7 @@ private double AsBaseUnit() private double AsBaseNumericType(LinearDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearPowerDensity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearPowerDensity.g.cs index fe74f9c80b..b550dd71dc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearPowerDensity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearPowerDensity.g.cs @@ -82,7 +82,7 @@ public LinearPowerDensity() /// If value is NaN or Infinity. private LinearPowerDensity(double value, LinearPowerDensityUnit unit) { - if(unit == LinearPowerDensityUnit.Undefined) + if (unit == LinearPowerDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -767,8 +767,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LinearPowerDensity objLinearPowerDensity)) throw new ArgumentException("Expected type LinearPowerDensity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is LinearPowerDensity objLinearPowerDensity)) throw new ArgumentException("Expected type LinearPowerDensity.", nameof(obj)); return CompareTo(objLinearPowerDensity); } @@ -782,7 +782,7 @@ internal int CompareTo(LinearPowerDensity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is LinearPowerDensity objLinearPowerDensity)) + if (obj is null || !(obj is LinearPowerDensity objLinearPowerDensity)) return false; return Equals(objLinearPowerDensity); @@ -835,7 +835,7 @@ public bool Equals(LinearPowerDensity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(LinearPowerDensity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -865,7 +865,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(LinearPowerDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -923,7 +923,7 @@ private double AsBaseUnit() private double AsBaseNumericType(LinearPowerDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Luminosity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Luminosity.g.cs index ebd036ec21..332aacd931 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Luminosity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Luminosity.g.cs @@ -82,7 +82,7 @@ public Luminosity() /// If value is NaN or Infinity. private Luminosity(double value, LuminosityUnit unit) { - if(unit == LuminosityUnit.Undefined) + if (unit == LuminosityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -591,8 +591,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Luminosity objLuminosity)) throw new ArgumentException("Expected type Luminosity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Luminosity objLuminosity)) throw new ArgumentException("Expected type Luminosity.", nameof(obj)); return CompareTo(objLuminosity); } @@ -606,7 +606,7 @@ internal int CompareTo(Luminosity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Luminosity objLuminosity)) + if (obj is null || !(obj is Luminosity objLuminosity)) return false; return Equals(objLuminosity); @@ -659,7 +659,7 @@ public bool Equals(Luminosity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Luminosity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -689,7 +689,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(LuminosityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -736,7 +736,7 @@ private double AsBaseUnit() private double AsBaseNumericType(LuminosityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.g.cs index 6584f8206c..8a4f04e7a3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.g.cs @@ -82,7 +82,7 @@ public LuminousFlux() /// If value is NaN or Infinity. private LuminousFlux(double value, LuminousFluxUnit unit) { - if(unit == LuminousFluxUnit.Undefined) + if (unit == LuminousFluxUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -383,8 +383,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LuminousFlux objLuminousFlux)) throw new ArgumentException("Expected type LuminousFlux.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is LuminousFlux objLuminousFlux)) throw new ArgumentException("Expected type LuminousFlux.", nameof(obj)); return CompareTo(objLuminousFlux); } @@ -398,7 +398,7 @@ internal int CompareTo(LuminousFlux other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is LuminousFlux objLuminousFlux)) + if (obj is null || !(obj is LuminousFlux objLuminousFlux)) return false; return Equals(objLuminousFlux); @@ -451,7 +451,7 @@ public bool Equals(LuminousFlux other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(LuminousFlux other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -481,7 +481,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(LuminousFluxUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -515,7 +515,7 @@ private double AsBaseUnit() private double AsBaseNumericType(LuminousFluxUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.g.cs index c563010b03..66f7071747 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -82,7 +82,7 @@ public LuminousIntensity() /// If value is NaN or Infinity. private LuminousIntensity(double value, LuminousIntensityUnit unit) { - if(unit == LuminousIntensityUnit.Undefined) + if (unit == LuminousIntensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -383,8 +383,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LuminousIntensity objLuminousIntensity)) throw new ArgumentException("Expected type LuminousIntensity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is LuminousIntensity objLuminousIntensity)) throw new ArgumentException("Expected type LuminousIntensity.", nameof(obj)); return CompareTo(objLuminousIntensity); } @@ -398,7 +398,7 @@ internal int CompareTo(LuminousIntensity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is LuminousIntensity objLuminousIntensity)) + if (obj is null || !(obj is LuminousIntensity objLuminousIntensity)) return false; return Equals(objLuminousIntensity); @@ -451,7 +451,7 @@ public bool Equals(LuminousIntensity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(LuminousIntensity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -481,7 +481,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(LuminousIntensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -515,7 +515,7 @@ private double AsBaseUnit() private double AsBaseNumericType(LuminousIntensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.g.cs index 1f07789a1e..c271fdd919 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.g.cs @@ -82,7 +82,7 @@ public MagneticField() /// If value is NaN or Infinity. private MagneticField(double value, MagneticFieldUnit unit) { - if(unit == MagneticFieldUnit.Undefined) + if (unit == MagneticFieldUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -463,8 +463,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MagneticField objMagneticField)) throw new ArgumentException("Expected type MagneticField.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MagneticField objMagneticField)) throw new ArgumentException("Expected type MagneticField.", nameof(obj)); return CompareTo(objMagneticField); } @@ -478,7 +478,7 @@ internal int CompareTo(MagneticField other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is MagneticField objMagneticField)) + if (obj is null || !(obj is MagneticField objMagneticField)) return false; return Equals(objMagneticField); @@ -531,7 +531,7 @@ public bool Equals(MagneticField other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MagneticField other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -561,7 +561,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MagneticFieldUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -600,7 +600,7 @@ private double AsBaseUnit() private double AsBaseNumericType(MagneticFieldUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.g.cs index 4b445bf7a1..faeece1ef6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.g.cs @@ -82,7 +82,7 @@ public MagneticFlux() /// If value is NaN or Infinity. private MagneticFlux(double value, MagneticFluxUnit unit) { - if(unit == MagneticFluxUnit.Undefined) + if (unit == MagneticFluxUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -383,8 +383,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MagneticFlux objMagneticFlux)) throw new ArgumentException("Expected type MagneticFlux.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MagneticFlux objMagneticFlux)) throw new ArgumentException("Expected type MagneticFlux.", nameof(obj)); return CompareTo(objMagneticFlux); } @@ -398,7 +398,7 @@ internal int CompareTo(MagneticFlux other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is MagneticFlux objMagneticFlux)) + if (obj is null || !(obj is MagneticFlux objMagneticFlux)) return false; return Equals(objMagneticFlux); @@ -451,7 +451,7 @@ public bool Equals(MagneticFlux other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MagneticFlux other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -481,7 +481,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MagneticFluxUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -515,7 +515,7 @@ private double AsBaseUnit() private double AsBaseNumericType(MagneticFluxUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.g.cs index 504d3e9079..3b01381017 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.g.cs @@ -82,7 +82,7 @@ public Magnetization() /// If value is NaN or Infinity. private Magnetization(double value, MagnetizationUnit unit) { - if(unit == MagnetizationUnit.Undefined) + if (unit == MagnetizationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -383,8 +383,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Magnetization objMagnetization)) throw new ArgumentException("Expected type Magnetization.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Magnetization objMagnetization)) throw new ArgumentException("Expected type Magnetization.", nameof(obj)); return CompareTo(objMagnetization); } @@ -398,7 +398,7 @@ internal int CompareTo(Magnetization other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Magnetization objMagnetization)) + if (obj is null || !(obj is Magnetization objMagnetization)) return false; return Equals(objMagnetization); @@ -451,7 +451,7 @@ public bool Equals(Magnetization other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Magnetization other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -481,7 +481,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MagnetizationUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -515,7 +515,7 @@ private double AsBaseUnit() private double AsBaseNumericType(MagnetizationUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.g.cs index ec5ff19705..49c62ca387 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.g.cs @@ -79,7 +79,7 @@ public Mass() /// If value is NaN or Infinity. private Mass(double value, MassUnit unit) { - if(unit == MassUnit.Undefined) + if (unit == MassUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -799,8 +799,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Mass objMass)) throw new ArgumentException("Expected type Mass.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Mass objMass)) throw new ArgumentException("Expected type Mass.", nameof(obj)); return CompareTo(objMass); } @@ -814,7 +814,7 @@ internal int CompareTo(Mass other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Mass objMass)) + if (obj is null || !(obj is Mass objMass)) return false; return Equals(objMass); @@ -867,7 +867,7 @@ public bool Equals(Mass other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Mass other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -897,7 +897,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MassUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -955,7 +955,7 @@ private double AsBaseUnit() private double AsBaseNumericType(MassUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassConcentration.g.cs index 4a88c8464d..872fded7d3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassConcentration.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassConcentration.g.cs @@ -82,7 +82,7 @@ public MassConcentration() /// If value is NaN or Infinity. private MassConcentration(double value, MassConcentrationUnit unit) { - if(unit == MassConcentrationUnit.Undefined) + if (unit == MassConcentrationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -1155,8 +1155,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassConcentration objMassConcentration)) throw new ArgumentException("Expected type MassConcentration.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MassConcentration objMassConcentration)) throw new ArgumentException("Expected type MassConcentration.", nameof(obj)); return CompareTo(objMassConcentration); } @@ -1170,7 +1170,7 @@ internal int CompareTo(MassConcentration other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is MassConcentration objMassConcentration)) + if (obj is null || !(obj is MassConcentration objMassConcentration)) return false; return Equals(objMassConcentration); @@ -1223,7 +1223,7 @@ public bool Equals(MassConcentration other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MassConcentration other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1253,7 +1253,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MassConcentrationUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -1335,7 +1335,7 @@ private double AsBaseUnit() private double AsBaseNumericType(MassConcentrationUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.g.cs index c7d0ad9f6a..d68b476de7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.g.cs @@ -79,7 +79,7 @@ public MassFlow() /// If value is NaN or Infinity. private MassFlow(double value, MassFlowUnit unit) { - if(unit == MassFlowUnit.Undefined) + if (unit == MassFlowUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -894,8 +894,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassFlow objMassFlow)) throw new ArgumentException("Expected type MassFlow.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MassFlow objMassFlow)) throw new ArgumentException("Expected type MassFlow.", nameof(obj)); return CompareTo(objMassFlow); } @@ -909,7 +909,7 @@ internal int CompareTo(MassFlow other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is MassFlow objMassFlow)) + if (obj is null || !(obj is MassFlow objMassFlow)) return false; return Equals(objMassFlow); @@ -962,7 +962,7 @@ public bool Equals(MassFlow other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MassFlow other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -992,7 +992,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MassFlowUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -1058,7 +1058,7 @@ private double AsBaseUnit() private double AsBaseNumericType(MassFlowUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.g.cs index f63277aaa2..520adf33d1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.g.cs @@ -79,7 +79,7 @@ public MassFlux() /// If value is NaN or Infinity. private MassFlux(double value, MassFluxUnit unit) { - if(unit == MassFluxUnit.Undefined) + if (unit == MassFluxUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -556,8 +556,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassFlux objMassFlux)) throw new ArgumentException("Expected type MassFlux.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MassFlux objMassFlux)) throw new ArgumentException("Expected type MassFlux.", nameof(obj)); return CompareTo(objMassFlux); } @@ -571,7 +571,7 @@ internal int CompareTo(MassFlux other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is MassFlux objMassFlux)) + if (obj is null || !(obj is MassFlux objMassFlux)) return false; return Equals(objMassFlux); @@ -624,7 +624,7 @@ public bool Equals(MassFlux other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MassFlux other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -654,7 +654,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MassFluxUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -699,7 +699,7 @@ private double AsBaseUnit() private double AsBaseNumericType(MassFluxUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFraction.g.cs index 509ed009bb..a7aafb1bf5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFraction.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFraction.g.cs @@ -82,7 +82,7 @@ public MassFraction() /// If value is NaN or Infinity. private MassFraction(double value, MassFractionUnit unit) { - if(unit == MassFractionUnit.Undefined) + if (unit == MassFractionUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -751,8 +751,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassFraction objMassFraction)) throw new ArgumentException("Expected type MassFraction.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MassFraction objMassFraction)) throw new ArgumentException("Expected type MassFraction.", nameof(obj)); return CompareTo(objMassFraction); } @@ -766,7 +766,7 @@ internal int CompareTo(MassFraction other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is MassFraction objMassFraction)) + if (obj is null || !(obj is MassFraction objMassFraction)) return false; return Equals(objMassFraction); @@ -819,7 +819,7 @@ public bool Equals(MassFraction other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MassFraction other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -849,7 +849,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MassFractionUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -906,7 +906,7 @@ private double AsBaseUnit() private double AsBaseNumericType(MassFractionUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.g.cs index b69b5f14a7..e83c5dee56 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.g.cs @@ -79,7 +79,7 @@ public MassMomentOfInertia() /// If value is NaN or Infinity. private MassMomentOfInertia(double value, MassMomentOfInertiaUnit unit) { - if(unit == MassMomentOfInertiaUnit.Undefined) + if (unit == MassMomentOfInertiaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -812,8 +812,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassMomentOfInertia objMassMomentOfInertia)) throw new ArgumentException("Expected type MassMomentOfInertia.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MassMomentOfInertia objMassMomentOfInertia)) throw new ArgumentException("Expected type MassMomentOfInertia.", nameof(obj)); return CompareTo(objMassMomentOfInertia); } @@ -827,7 +827,7 @@ internal int CompareTo(MassMomentOfInertia other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is MassMomentOfInertia objMassMomentOfInertia)) + if (obj is null || !(obj is MassMomentOfInertia objMassMomentOfInertia)) return false; return Equals(objMassMomentOfInertia); @@ -880,7 +880,7 @@ public bool Equals(MassMomentOfInertia other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MassMomentOfInertia other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -910,7 +910,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MassMomentOfInertiaUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -971,7 +971,7 @@ private double AsBaseUnit() private double AsBaseNumericType(MassMomentOfInertiaUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.g.cs index ecda639c2d..0a553bcb19 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.g.cs @@ -79,7 +79,7 @@ public MolarEnergy() /// If value is NaN or Infinity. private MolarEnergy(double value, MolarEnergyUnit unit) { - if(unit == MolarEnergyUnit.Undefined) + if (unit == MolarEnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -412,8 +412,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarEnergy objMolarEnergy)) throw new ArgumentException("Expected type MolarEnergy.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MolarEnergy objMolarEnergy)) throw new ArgumentException("Expected type MolarEnergy.", nameof(obj)); return CompareTo(objMolarEnergy); } @@ -427,7 +427,7 @@ internal int CompareTo(MolarEnergy other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is MolarEnergy objMolarEnergy)) + if (obj is null || !(obj is MolarEnergy objMolarEnergy)) return false; return Equals(objMolarEnergy); @@ -480,7 +480,7 @@ public bool Equals(MolarEnergy other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MolarEnergy other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -510,7 +510,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MolarEnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -546,7 +546,7 @@ private double AsBaseUnit() private double AsBaseNumericType(MolarEnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.g.cs index 09f234025b..c7b2a814a2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.g.cs @@ -79,7 +79,7 @@ public MolarEntropy() /// If value is NaN or Infinity. private MolarEntropy(double value, MolarEntropyUnit unit) { - if(unit == MolarEntropyUnit.Undefined) + if (unit == MolarEntropyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -412,8 +412,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarEntropy objMolarEntropy)) throw new ArgumentException("Expected type MolarEntropy.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MolarEntropy objMolarEntropy)) throw new ArgumentException("Expected type MolarEntropy.", nameof(obj)); return CompareTo(objMolarEntropy); } @@ -427,7 +427,7 @@ internal int CompareTo(MolarEntropy other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is MolarEntropy objMolarEntropy)) + if (obj is null || !(obj is MolarEntropy objMolarEntropy)) return false; return Equals(objMolarEntropy); @@ -480,7 +480,7 @@ public bool Equals(MolarEntropy other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MolarEntropy other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -510,7 +510,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MolarEntropyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -546,7 +546,7 @@ private double AsBaseUnit() private double AsBaseNumericType(MolarEntropyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.g.cs index f117d879d2..03cb80a727 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.g.cs @@ -79,7 +79,7 @@ public MolarMass() /// If value is NaN or Infinity. private MolarMass(double value, MolarMassUnit unit) { - if(unit == MolarMassUnit.Undefined) + if (unit == MolarMassUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -568,8 +568,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarMass objMolarMass)) throw new ArgumentException("Expected type MolarMass.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MolarMass objMolarMass)) throw new ArgumentException("Expected type MolarMass.", nameof(obj)); return CompareTo(objMolarMass); } @@ -583,7 +583,7 @@ internal int CompareTo(MolarMass other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is MolarMass objMolarMass)) + if (obj is null || !(obj is MolarMass objMolarMass)) return false; return Equals(objMolarMass); @@ -636,7 +636,7 @@ public bool Equals(MolarMass other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MolarMass other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -666,7 +666,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MolarMassUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -711,7 +711,7 @@ private double AsBaseUnit() private double AsBaseNumericType(MolarMassUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.g.cs index d76669ec22..a399dd8bee 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.g.cs @@ -82,7 +82,7 @@ public Molarity() /// If value is NaN or Infinity. private Molarity(double value, MolarityUnit unit) { - if(unit == MolarityUnit.Undefined) + if (unit == MolarityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -503,8 +503,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Molarity objMolarity)) throw new ArgumentException("Expected type Molarity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Molarity objMolarity)) throw new ArgumentException("Expected type Molarity.", nameof(obj)); return CompareTo(objMolarity); } @@ -518,7 +518,7 @@ internal int CompareTo(Molarity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Molarity objMolarity)) + if (obj is null || !(obj is Molarity objMolarity)) return false; return Equals(objMolarity); @@ -571,7 +571,7 @@ public bool Equals(Molarity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Molarity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -601,7 +601,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MolarityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -650,7 +650,7 @@ private double AsBaseUnit() private double AsBaseNumericType(MolarityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.g.cs index d9c6470ff0..36a2c289de 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.g.cs @@ -82,7 +82,7 @@ public Permeability() /// If value is NaN or Infinity. private Permeability(double value, PermeabilityUnit unit) { - if(unit == PermeabilityUnit.Undefined) + if (unit == PermeabilityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -383,8 +383,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Permeability objPermeability)) throw new ArgumentException("Expected type Permeability.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Permeability objPermeability)) throw new ArgumentException("Expected type Permeability.", nameof(obj)); return CompareTo(objPermeability); } @@ -398,7 +398,7 @@ internal int CompareTo(Permeability other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Permeability objPermeability)) + if (obj is null || !(obj is Permeability objPermeability)) return false; return Equals(objPermeability); @@ -451,7 +451,7 @@ public bool Equals(Permeability other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Permeability other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -481,7 +481,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(PermeabilityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -515,7 +515,7 @@ private double AsBaseUnit() private double AsBaseNumericType(PermeabilityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.g.cs index 3aabf981b6..2be704b964 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.g.cs @@ -82,7 +82,7 @@ public Permittivity() /// If value is NaN or Infinity. private Permittivity(double value, PermittivityUnit unit) { - if(unit == PermittivityUnit.Undefined) + if (unit == PermittivityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -383,8 +383,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Permittivity objPermittivity)) throw new ArgumentException("Expected type Permittivity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Permittivity objPermittivity)) throw new ArgumentException("Expected type Permittivity.", nameof(obj)); return CompareTo(objPermittivity); } @@ -398,7 +398,7 @@ internal int CompareTo(Permittivity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Permittivity objPermittivity)) + if (obj is null || !(obj is Permittivity objPermittivity)) return false; return Equals(objPermittivity); @@ -451,7 +451,7 @@ public bool Equals(Permittivity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Permittivity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -481,7 +481,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(PermittivityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -515,7 +515,7 @@ private double AsBaseUnit() private double AsBaseNumericType(PermittivityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.g.cs index 1712349217..93606fff52 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.g.cs @@ -79,7 +79,7 @@ public Power() /// If value is NaN or Infinity. private Power(decimal value, PowerUnit unit) { - if(unit == PowerUnit.Undefined) + if (unit == PowerUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = value; @@ -764,8 +764,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Power objPower)) throw new ArgumentException("Expected type Power.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Power objPower)) throw new ArgumentException("Expected type Power.", nameof(obj)); return CompareTo(objPower); } @@ -779,7 +779,7 @@ internal int CompareTo(Power other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Power objPower)) + if (obj is null || !(obj is Power objPower)) return false; return Equals(objPower); @@ -832,7 +832,7 @@ public bool Equals(Power other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Power other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -862,7 +862,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(PowerUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -920,7 +920,7 @@ private decimal AsBaseUnit() private decimal AsBaseNumericType(PowerUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.g.cs index 1314e7021e..976c80b9d8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.g.cs @@ -79,7 +79,7 @@ public PowerDensity() /// If value is NaN or Infinity. private PowerDensity(double value, PowerDensityUnit unit) { - if(unit == PowerDensityUnit.Undefined) + if (unit == PowerDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -1068,8 +1068,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PowerDensity objPowerDensity)) throw new ArgumentException("Expected type PowerDensity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is PowerDensity objPowerDensity)) throw new ArgumentException("Expected type PowerDensity.", nameof(obj)); return CompareTo(objPowerDensity); } @@ -1083,7 +1083,7 @@ internal int CompareTo(PowerDensity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is PowerDensity objPowerDensity)) + if (obj is null || !(obj is PowerDensity objPowerDensity)) return false; return Equals(objPowerDensity); @@ -1136,7 +1136,7 @@ public bool Equals(PowerDensity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(PowerDensity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1166,7 +1166,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(PowerDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -1243,7 +1243,7 @@ private double AsBaseUnit() private double AsBaseNumericType(PowerDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.g.cs index b07742312e..c51661eb7b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.g.cs @@ -79,7 +79,7 @@ public PowerRatio() /// If value is NaN or Infinity. private PowerRatio(double value, PowerRatioUnit unit) { - if(unit == PowerRatioUnit.Undefined) + if (unit == PowerRatioUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -396,8 +396,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PowerRatio objPowerRatio)) throw new ArgumentException("Expected type PowerRatio.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is PowerRatio objPowerRatio)) throw new ArgumentException("Expected type PowerRatio.", nameof(obj)); return CompareTo(objPowerRatio); } @@ -411,7 +411,7 @@ internal int CompareTo(PowerRatio other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is PowerRatio objPowerRatio)) + if (obj is null || !(obj is PowerRatio objPowerRatio)) return false; return Equals(objPowerRatio); @@ -464,7 +464,7 @@ public bool Equals(PowerRatio other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(PowerRatio other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -494,7 +494,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(PowerRatioUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -529,7 +529,7 @@ private double AsBaseUnit() private double AsBaseNumericType(PowerRatioUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.g.cs index 14b5623726..5932901e87 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.g.cs @@ -79,7 +79,7 @@ public Pressure() /// If value is NaN or Infinity. private Pressure(double value, PressureUnit unit) { - if(unit == PressureUnit.Undefined) + if (unit == PressureUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -1115,8 +1115,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Pressure objPressure)) throw new ArgumentException("Expected type Pressure.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Pressure objPressure)) throw new ArgumentException("Expected type Pressure.", nameof(obj)); return CompareTo(objPressure); } @@ -1130,7 +1130,7 @@ internal int CompareTo(Pressure other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Pressure objPressure)) + if (obj is null || !(obj is Pressure objPressure)) return false; return Equals(objPressure); @@ -1183,7 +1183,7 @@ public bool Equals(Pressure other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Pressure other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1213,7 +1213,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(PressureUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -1291,7 +1291,7 @@ private double AsBaseUnit() private double AsBaseNumericType(PressureUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.g.cs index c53e30e679..08503d898a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -79,7 +79,7 @@ public PressureChangeRate() /// If value is NaN or Infinity. private PressureChangeRate(double value, PressureChangeRateUnit unit) { - if(unit == PressureChangeRateUnit.Undefined) + if (unit == PressureChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -602,8 +602,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PressureChangeRate objPressureChangeRate)) throw new ArgumentException("Expected type PressureChangeRate.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is PressureChangeRate objPressureChangeRate)) throw new ArgumentException("Expected type PressureChangeRate.", nameof(obj)); return CompareTo(objPressureChangeRate); } @@ -617,7 +617,7 @@ internal int CompareTo(PressureChangeRate other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is PressureChangeRate objPressureChangeRate)) + if (obj is null || !(obj is PressureChangeRate objPressureChangeRate)) return false; return Equals(objPressureChangeRate); @@ -670,7 +670,7 @@ public bool Equals(PressureChangeRate other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(PressureChangeRate other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -700,7 +700,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(PressureChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -747,7 +747,7 @@ private double AsBaseUnit() private double AsBaseNumericType(PressureChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.g.cs index 0086cb18f4..8a07d92081 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.g.cs @@ -79,7 +79,7 @@ public Ratio() /// If value is NaN or Infinity. private Ratio(double value, RatioUnit unit) { - if(unit == RatioUnit.Undefined) + if (unit == RatioUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -460,8 +460,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Ratio objRatio)) throw new ArgumentException("Expected type Ratio.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Ratio objRatio)) throw new ArgumentException("Expected type Ratio.", nameof(obj)); return CompareTo(objRatio); } @@ -475,7 +475,7 @@ internal int CompareTo(Ratio other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Ratio objRatio)) + if (obj is null || !(obj is Ratio objRatio)) return false; return Equals(objRatio); @@ -528,7 +528,7 @@ public bool Equals(Ratio other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Ratio other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -558,7 +558,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(RatioUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -597,7 +597,7 @@ private double AsBaseUnit() private double AsBaseNumericType(RatioUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RatioChangeRate.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RatioChangeRate.g.cs index b9f2b5847a..4d692b7bde 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RatioChangeRate.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RatioChangeRate.g.cs @@ -79,7 +79,7 @@ public RatioChangeRate() /// If value is NaN or Infinity. private RatioChangeRate(double value, RatioChangeRateUnit unit) { - if(unit == RatioChangeRateUnit.Undefined) + if (unit == RatioChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -396,8 +396,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RatioChangeRate objRatioChangeRate)) throw new ArgumentException("Expected type RatioChangeRate.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is RatioChangeRate objRatioChangeRate)) throw new ArgumentException("Expected type RatioChangeRate.", nameof(obj)); return CompareTo(objRatioChangeRate); } @@ -411,7 +411,7 @@ internal int CompareTo(RatioChangeRate other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is RatioChangeRate objRatioChangeRate)) + if (obj is null || !(obj is RatioChangeRate objRatioChangeRate)) return false; return Equals(objRatioChangeRate); @@ -464,7 +464,7 @@ public bool Equals(RatioChangeRate other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(RatioChangeRate other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -494,7 +494,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(RatioChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -529,7 +529,7 @@ private double AsBaseUnit() private double AsBaseNumericType(RatioChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.g.cs index a1d40dd734..5f7eec1adb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.g.cs @@ -79,7 +79,7 @@ public ReactiveEnergy() /// If value is NaN or Infinity. private ReactiveEnergy(double value, ReactiveEnergyUnit unit) { - if(unit == ReactiveEnergyUnit.Undefined) + if (unit == ReactiveEnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -412,8 +412,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ReactiveEnergy objReactiveEnergy)) throw new ArgumentException("Expected type ReactiveEnergy.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ReactiveEnergy objReactiveEnergy)) throw new ArgumentException("Expected type ReactiveEnergy.", nameof(obj)); return CompareTo(objReactiveEnergy); } @@ -427,7 +427,7 @@ internal int CompareTo(ReactiveEnergy other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ReactiveEnergy objReactiveEnergy)) + if (obj is null || !(obj is ReactiveEnergy objReactiveEnergy)) return false; return Equals(objReactiveEnergy); @@ -480,7 +480,7 @@ public bool Equals(ReactiveEnergy other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ReactiveEnergy other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -510,7 +510,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ReactiveEnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -546,7 +546,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ReactiveEnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.g.cs index 90861a750f..8ca633ef9f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.g.cs @@ -79,7 +79,7 @@ public ReactivePower() /// If value is NaN or Infinity. private ReactivePower(double value, ReactivePowerUnit unit) { - if(unit == ReactivePowerUnit.Undefined) + if (unit == ReactivePowerUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -428,8 +428,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ReactivePower objReactivePower)) throw new ArgumentException("Expected type ReactivePower.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ReactivePower objReactivePower)) throw new ArgumentException("Expected type ReactivePower.", nameof(obj)); return CompareTo(objReactivePower); } @@ -443,7 +443,7 @@ internal int CompareTo(ReactivePower other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ReactivePower objReactivePower)) + if (obj is null || !(obj is ReactivePower objReactivePower)) return false; return Equals(objReactivePower); @@ -496,7 +496,7 @@ public bool Equals(ReactivePower other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ReactivePower other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -526,7 +526,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ReactivePowerUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -563,7 +563,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ReactivePowerUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReciprocalArea.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReciprocalArea.g.cs index 84c6f683af..31ebdaaf6d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReciprocalArea.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReciprocalArea.g.cs @@ -82,7 +82,7 @@ public ReciprocalArea() /// If value is NaN or Infinity. private ReciprocalArea(double value, ReciprocalAreaUnit unit) { - if(unit == ReciprocalAreaUnit.Undefined) + if (unit == ReciprocalAreaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -543,8 +543,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ReciprocalArea objReciprocalArea)) throw new ArgumentException("Expected type ReciprocalArea.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ReciprocalArea objReciprocalArea)) throw new ArgumentException("Expected type ReciprocalArea.", nameof(obj)); return CompareTo(objReciprocalArea); } @@ -558,7 +558,7 @@ internal int CompareTo(ReciprocalArea other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ReciprocalArea objReciprocalArea)) + if (obj is null || !(obj is ReciprocalArea objReciprocalArea)) return false; return Equals(objReciprocalArea); @@ -611,7 +611,7 @@ public bool Equals(ReciprocalArea other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ReciprocalArea other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -641,7 +641,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ReciprocalAreaUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -685,7 +685,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ReciprocalAreaUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReciprocalLength.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReciprocalLength.g.cs index 8033170377..8be9e4b9ca 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReciprocalLength.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReciprocalLength.g.cs @@ -82,7 +82,7 @@ public ReciprocalLength() /// If value is NaN or Infinity. private ReciprocalLength(double value, ReciprocalLengthUnit unit) { - if(unit == ReciprocalLengthUnit.Undefined) + if (unit == ReciprocalLengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -527,8 +527,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ReciprocalLength objReciprocalLength)) throw new ArgumentException("Expected type ReciprocalLength.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ReciprocalLength objReciprocalLength)) throw new ArgumentException("Expected type ReciprocalLength.", nameof(obj)); return CompareTo(objReciprocalLength); } @@ -542,7 +542,7 @@ internal int CompareTo(ReciprocalLength other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ReciprocalLength objReciprocalLength)) + if (obj is null || !(obj is ReciprocalLength objReciprocalLength)) return false; return Equals(objReciprocalLength); @@ -595,7 +595,7 @@ public bool Equals(ReciprocalLength other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ReciprocalLength other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -625,7 +625,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ReciprocalLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -668,7 +668,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ReciprocalLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RelativeHumidity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RelativeHumidity.g.cs index e16b2530c5..06283a74f0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RelativeHumidity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RelativeHumidity.g.cs @@ -79,7 +79,7 @@ public RelativeHumidity() /// If value is NaN or Infinity. private RelativeHumidity(double value, RelativeHumidityUnit unit) { - if(unit == RelativeHumidityUnit.Undefined) + if (unit == RelativeHumidityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -380,8 +380,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RelativeHumidity objRelativeHumidity)) throw new ArgumentException("Expected type RelativeHumidity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is RelativeHumidity objRelativeHumidity)) throw new ArgumentException("Expected type RelativeHumidity.", nameof(obj)); return CompareTo(objRelativeHumidity); } @@ -395,7 +395,7 @@ internal int CompareTo(RelativeHumidity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is RelativeHumidity objRelativeHumidity)) + if (obj is null || !(obj is RelativeHumidity objRelativeHumidity)) return false; return Equals(objRelativeHumidity); @@ -448,7 +448,7 @@ public bool Equals(RelativeHumidity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(RelativeHumidity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -478,7 +478,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(RelativeHumidityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -512,7 +512,7 @@ private double AsBaseUnit() private double AsBaseNumericType(RelativeHumidityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.g.cs index 49f4b681c0..446b86a87f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.g.cs @@ -79,7 +79,7 @@ public RotationalAcceleration() /// If value is NaN or Infinity. private RotationalAcceleration(double value, RotationalAccelerationUnit unit) { - if(unit == RotationalAccelerationUnit.Undefined) + if (unit == RotationalAccelerationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -428,8 +428,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalAcceleration objRotationalAcceleration)) throw new ArgumentException("Expected type RotationalAcceleration.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is RotationalAcceleration objRotationalAcceleration)) throw new ArgumentException("Expected type RotationalAcceleration.", nameof(obj)); return CompareTo(objRotationalAcceleration); } @@ -443,7 +443,7 @@ internal int CompareTo(RotationalAcceleration other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is RotationalAcceleration objRotationalAcceleration)) + if (obj is null || !(obj is RotationalAcceleration objRotationalAcceleration)) return false; return Equals(objRotationalAcceleration); @@ -496,7 +496,7 @@ public bool Equals(RotationalAcceleration other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(RotationalAcceleration other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -526,7 +526,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(RotationalAccelerationUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -563,7 +563,7 @@ private double AsBaseUnit() private double AsBaseNumericType(RotationalAccelerationUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.g.cs index e400ee3afc..0e34cfc097 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -79,7 +79,7 @@ public RotationalSpeed() /// If value is NaN or Infinity. private RotationalSpeed(double value, RotationalSpeedUnit unit) { - if(unit == RotationalSpeedUnit.Undefined) + if (unit == RotationalSpeedUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -584,8 +584,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalSpeed objRotationalSpeed)) throw new ArgumentException("Expected type RotationalSpeed.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is RotationalSpeed objRotationalSpeed)) throw new ArgumentException("Expected type RotationalSpeed.", nameof(obj)); return CompareTo(objRotationalSpeed); } @@ -599,7 +599,7 @@ internal int CompareTo(RotationalSpeed other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is RotationalSpeed objRotationalSpeed)) + if (obj is null || !(obj is RotationalSpeed objRotationalSpeed)) return false; return Equals(objRotationalSpeed); @@ -652,7 +652,7 @@ public bool Equals(RotationalSpeed other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(RotationalSpeed other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -682,7 +682,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(RotationalSpeedUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -728,7 +728,7 @@ private double AsBaseUnit() private double AsBaseNumericType(RotationalSpeedUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.g.cs index 6728dce628..b510e3f1d1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -79,7 +79,7 @@ public RotationalStiffness() /// If value is NaN or Infinity. private RotationalStiffness(double value, RotationalStiffnessUnit unit) { - if(unit == RotationalStiffnessUnit.Undefined) + if (unit == RotationalStiffnessUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -892,8 +892,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalStiffness objRotationalStiffness)) throw new ArgumentException("Expected type RotationalStiffness.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is RotationalStiffness objRotationalStiffness)) throw new ArgumentException("Expected type RotationalStiffness.", nameof(obj)); return CompareTo(objRotationalStiffness); } @@ -907,7 +907,7 @@ internal int CompareTo(RotationalStiffness other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is RotationalStiffness objRotationalStiffness)) + if (obj is null || !(obj is RotationalStiffness objRotationalStiffness)) return false; return Equals(objRotationalStiffness); @@ -960,7 +960,7 @@ public bool Equals(RotationalStiffness other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(RotationalStiffness other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -990,7 +990,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(RotationalStiffnessUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -1056,7 +1056,7 @@ private double AsBaseUnit() private double AsBaseNumericType(RotationalStiffnessUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs index 98679dcb87..206401d613 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -79,7 +79,7 @@ public RotationalStiffnessPerLength() /// If value is NaN or Infinity. private RotationalStiffnessPerLength(double value, RotationalStiffnessPerLengthUnit unit) { - if(unit == RotationalStiffnessPerLengthUnit.Undefined) + if (unit == RotationalStiffnessPerLengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -444,8 +444,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalStiffnessPerLength objRotationalStiffnessPerLength)) throw new ArgumentException("Expected type RotationalStiffnessPerLength.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is RotationalStiffnessPerLength objRotationalStiffnessPerLength)) throw new ArgumentException("Expected type RotationalStiffnessPerLength.", nameof(obj)); return CompareTo(objRotationalStiffnessPerLength); } @@ -459,7 +459,7 @@ internal int CompareTo(RotationalStiffnessPerLength other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is RotationalStiffnessPerLength objRotationalStiffnessPerLength)) + if (obj is null || !(obj is RotationalStiffnessPerLength objRotationalStiffnessPerLength)) return false; return Equals(objRotationalStiffnessPerLength); @@ -512,7 +512,7 @@ public bool Equals(RotationalStiffnessPerLength other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(RotationalStiffnessPerLength other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -542,7 +542,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(RotationalStiffnessPerLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -580,7 +580,7 @@ private double AsBaseUnit() private double AsBaseNumericType(RotationalStiffnessPerLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Scalar.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Scalar.g.cs index e5ef3452a5..34d029e0ec 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Scalar.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Scalar.g.cs @@ -79,7 +79,7 @@ public Scalar() /// If value is NaN or Infinity. private Scalar(double value, ScalarUnit unit) { - if(unit == ScalarUnit.Undefined) + if (unit == ScalarUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -380,8 +380,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Scalar objScalar)) throw new ArgumentException("Expected type Scalar.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Scalar objScalar)) throw new ArgumentException("Expected type Scalar.", nameof(obj)); return CompareTo(objScalar); } @@ -395,7 +395,7 @@ internal int CompareTo(Scalar other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Scalar objScalar)) + if (obj is null || !(obj is Scalar objScalar)) return false; return Equals(objScalar); @@ -448,7 +448,7 @@ public bool Equals(Scalar other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Scalar other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -478,7 +478,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ScalarUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -512,7 +512,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ScalarUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.g.cs index 8c13eb1e89..4a9b4e4369 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.g.cs @@ -82,7 +82,7 @@ public SolidAngle() /// If value is NaN or Infinity. private SolidAngle(double value, SolidAngleUnit unit) { - if(unit == SolidAngleUnit.Undefined) + if (unit == SolidAngleUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -383,8 +383,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SolidAngle objSolidAngle)) throw new ArgumentException("Expected type SolidAngle.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is SolidAngle objSolidAngle)) throw new ArgumentException("Expected type SolidAngle.", nameof(obj)); return CompareTo(objSolidAngle); } @@ -398,7 +398,7 @@ internal int CompareTo(SolidAngle other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is SolidAngle objSolidAngle)) + if (obj is null || !(obj is SolidAngle objSolidAngle)) return false; return Equals(objSolidAngle); @@ -451,7 +451,7 @@ public bool Equals(SolidAngle other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(SolidAngle other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -481,7 +481,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(SolidAngleUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -515,7 +515,7 @@ private double AsBaseUnit() private double AsBaseNumericType(SolidAngleUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.g.cs index d4baf22c58..63e7a8b40f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -82,7 +82,7 @@ public SpecificEnergy() /// If value is NaN or Infinity. private SpecificEnergy(double value, SpecificEnergyUnit unit) { - if(unit == SpecificEnergyUnit.Undefined) + if (unit == SpecificEnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -767,8 +767,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificEnergy objSpecificEnergy)) throw new ArgumentException("Expected type SpecificEnergy.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is SpecificEnergy objSpecificEnergy)) throw new ArgumentException("Expected type SpecificEnergy.", nameof(obj)); return CompareTo(objSpecificEnergy); } @@ -782,7 +782,7 @@ internal int CompareTo(SpecificEnergy other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is SpecificEnergy objSpecificEnergy)) + if (obj is null || !(obj is SpecificEnergy objSpecificEnergy)) return false; return Equals(objSpecificEnergy); @@ -835,7 +835,7 @@ public bool Equals(SpecificEnergy other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(SpecificEnergy other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -865,7 +865,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(SpecificEnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -923,7 +923,7 @@ private double AsBaseUnit() private double AsBaseNumericType(SpecificEnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.g.cs index 1cef1ca55c..acad505d30 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -79,7 +79,7 @@ public SpecificEntropy() /// If value is NaN or Infinity. private SpecificEntropy(double value, SpecificEntropyUnit unit) { - if(unit == SpecificEntropyUnit.Undefined) + if (unit == SpecificEntropyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -508,8 +508,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificEntropy objSpecificEntropy)) throw new ArgumentException("Expected type SpecificEntropy.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is SpecificEntropy objSpecificEntropy)) throw new ArgumentException("Expected type SpecificEntropy.", nameof(obj)); return CompareTo(objSpecificEntropy); } @@ -523,7 +523,7 @@ internal int CompareTo(SpecificEntropy other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is SpecificEntropy objSpecificEntropy)) + if (obj is null || !(obj is SpecificEntropy objSpecificEntropy)) return false; return Equals(objSpecificEntropy); @@ -576,7 +576,7 @@ public bool Equals(SpecificEntropy other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(SpecificEntropy other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -606,7 +606,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(SpecificEntropyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -648,7 +648,7 @@ private double AsBaseUnit() private double AsBaseNumericType(SpecificEntropyUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs index 25320a3d5f..f8cf569f6a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs @@ -82,7 +82,7 @@ public SpecificFuelConsumption() /// If value is NaN or Infinity. private SpecificFuelConsumption(double value, SpecificFuelConsumptionUnit unit) { - if(unit == SpecificFuelConsumptionUnit.Undefined) + if (unit == SpecificFuelConsumptionUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -431,8 +431,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificFuelConsumption objSpecificFuelConsumption)) throw new ArgumentException("Expected type SpecificFuelConsumption.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is SpecificFuelConsumption objSpecificFuelConsumption)) throw new ArgumentException("Expected type SpecificFuelConsumption.", nameof(obj)); return CompareTo(objSpecificFuelConsumption); } @@ -446,7 +446,7 @@ internal int CompareTo(SpecificFuelConsumption other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is SpecificFuelConsumption objSpecificFuelConsumption)) + if (obj is null || !(obj is SpecificFuelConsumption objSpecificFuelConsumption)) return false; return Equals(objSpecificFuelConsumption); @@ -499,7 +499,7 @@ public bool Equals(SpecificFuelConsumption other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(SpecificFuelConsumption other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -529,7 +529,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(SpecificFuelConsumptionUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -566,7 +566,7 @@ private double AsBaseUnit() private double AsBaseNumericType(SpecificFuelConsumptionUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.g.cs index 8b8ca01120..8a39f43d1f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -79,7 +79,7 @@ public SpecificVolume() /// If value is NaN or Infinity. private SpecificVolume(double value, SpecificVolumeUnit unit) { - if(unit == SpecificVolumeUnit.Undefined) + if (unit == SpecificVolumeUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -412,8 +412,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificVolume objSpecificVolume)) throw new ArgumentException("Expected type SpecificVolume.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is SpecificVolume objSpecificVolume)) throw new ArgumentException("Expected type SpecificVolume.", nameof(obj)); return CompareTo(objSpecificVolume); } @@ -427,7 +427,7 @@ internal int CompareTo(SpecificVolume other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is SpecificVolume objSpecificVolume)) + if (obj is null || !(obj is SpecificVolume objSpecificVolume)) return false; return Equals(objSpecificVolume); @@ -480,7 +480,7 @@ public bool Equals(SpecificVolume other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(SpecificVolume other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -510,7 +510,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(SpecificVolumeUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -546,7 +546,7 @@ private double AsBaseUnit() private double AsBaseNumericType(SpecificVolumeUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.g.cs index 3be15a1d8b..81c136fe9d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -82,7 +82,7 @@ public SpecificWeight() /// If value is NaN or Infinity. private SpecificWeight(double value, SpecificWeightUnit unit) { - if(unit == SpecificWeightUnit.Undefined) + if (unit == SpecificWeightUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -639,8 +639,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificWeight objSpecificWeight)) throw new ArgumentException("Expected type SpecificWeight.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is SpecificWeight objSpecificWeight)) throw new ArgumentException("Expected type SpecificWeight.", nameof(obj)); return CompareTo(objSpecificWeight); } @@ -654,7 +654,7 @@ internal int CompareTo(SpecificWeight other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is SpecificWeight objSpecificWeight)) + if (obj is null || !(obj is SpecificWeight objSpecificWeight)) return false; return Equals(objSpecificWeight); @@ -707,7 +707,7 @@ public bool Equals(SpecificWeight other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(SpecificWeight other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -737,7 +737,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(SpecificWeightUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -787,7 +787,7 @@ private double AsBaseUnit() private double AsBaseNumericType(SpecificWeightUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.g.cs index 115fcc5700..873f7867ad 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.g.cs @@ -79,7 +79,7 @@ public Speed() /// If value is NaN or Infinity. private Speed(double value, SpeedUnit unit) { - if(unit == SpeedUnit.Undefined) + if (unit == SpeedUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -899,8 +899,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Speed objSpeed)) throw new ArgumentException("Expected type Speed.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Speed objSpeed)) throw new ArgumentException("Expected type Speed.", nameof(obj)); return CompareTo(objSpeed); } @@ -914,7 +914,7 @@ internal int CompareTo(Speed other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Speed objSpeed)) + if (obj is null || !(obj is Speed objSpeed)) return false; return Equals(objSpeed); @@ -967,7 +967,7 @@ public bool Equals(Speed other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Speed other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -997,7 +997,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(SpeedUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -1062,7 +1062,7 @@ private double AsBaseUnit() private double AsBaseNumericType(SpeedUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/StandardVolumeFlow.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/StandardVolumeFlow.g.cs index 908453cf70..29275812e1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/StandardVolumeFlow.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/StandardVolumeFlow.g.cs @@ -79,7 +79,7 @@ public StandardVolumeFlow() /// If value is NaN or Infinity. private StandardVolumeFlow(double value, StandardVolumeFlowUnit unit) { - if(unit == StandardVolumeFlowUnit.Undefined) + if (unit == StandardVolumeFlowUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -508,8 +508,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is StandardVolumeFlow objStandardVolumeFlow)) throw new ArgumentException("Expected type StandardVolumeFlow.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is StandardVolumeFlow objStandardVolumeFlow)) throw new ArgumentException("Expected type StandardVolumeFlow.", nameof(obj)); return CompareTo(objStandardVolumeFlow); } @@ -523,7 +523,7 @@ internal int CompareTo(StandardVolumeFlow other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is StandardVolumeFlow objStandardVolumeFlow)) + if (obj is null || !(obj is StandardVolumeFlow objStandardVolumeFlow)) return false; return Equals(objStandardVolumeFlow); @@ -576,7 +576,7 @@ public bool Equals(StandardVolumeFlow other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(StandardVolumeFlow other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -606,7 +606,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(StandardVolumeFlowUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -648,7 +648,7 @@ private double AsBaseUnit() private double AsBaseNumericType(StandardVolumeFlowUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.g.cs index 932fcf75bf..869039fa57 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.g.cs @@ -79,7 +79,7 @@ public Temperature() /// If value is NaN or Infinity. private Temperature(double value, TemperatureUnit unit) { - if(unit == TemperatureUnit.Undefined) + if (unit == TemperatureUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -524,8 +524,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Temperature objTemperature)) throw new ArgumentException("Expected type Temperature.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Temperature objTemperature)) throw new ArgumentException("Expected type Temperature.", nameof(obj)); return CompareTo(objTemperature); } @@ -539,7 +539,7 @@ internal int CompareTo(Temperature other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Temperature objTemperature)) + if (obj is null || !(obj is Temperature objTemperature)) return false; return Equals(objTemperature); @@ -592,7 +592,7 @@ public bool Equals(Temperature other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Temperature other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -622,7 +622,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(TemperatureUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -665,7 +665,7 @@ private double AsBaseUnit() private double AsBaseNumericType(TemperatureUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.g.cs index f02eb2fcea..f82f194922 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -79,7 +79,7 @@ public TemperatureChangeRate() /// If value is NaN or Infinity. private TemperatureChangeRate(double value, TemperatureChangeRateUnit unit) { - if(unit == TemperatureChangeRateUnit.Undefined) + if (unit == TemperatureChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -524,8 +524,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is TemperatureChangeRate objTemperatureChangeRate)) throw new ArgumentException("Expected type TemperatureChangeRate.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is TemperatureChangeRate objTemperatureChangeRate)) throw new ArgumentException("Expected type TemperatureChangeRate.", nameof(obj)); return CompareTo(objTemperatureChangeRate); } @@ -539,7 +539,7 @@ internal int CompareTo(TemperatureChangeRate other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is TemperatureChangeRate objTemperatureChangeRate)) + if (obj is null || !(obj is TemperatureChangeRate objTemperatureChangeRate)) return false; return Equals(objTemperatureChangeRate); @@ -592,7 +592,7 @@ public bool Equals(TemperatureChangeRate other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(TemperatureChangeRate other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -622,7 +622,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(TemperatureChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -665,7 +665,7 @@ private double AsBaseUnit() private double AsBaseNumericType(TemperatureChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.g.cs index 61e152a2a9..9d53881c24 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -79,7 +79,7 @@ public TemperatureDelta() /// If value is NaN or Infinity. private TemperatureDelta(double value, TemperatureDeltaUnit unit) { - if(unit == TemperatureDeltaUnit.Undefined) + if (unit == TemperatureDeltaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -508,8 +508,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is TemperatureDelta objTemperatureDelta)) throw new ArgumentException("Expected type TemperatureDelta.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is TemperatureDelta objTemperatureDelta)) throw new ArgumentException("Expected type TemperatureDelta.", nameof(obj)); return CompareTo(objTemperatureDelta); } @@ -523,7 +523,7 @@ internal int CompareTo(TemperatureDelta other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is TemperatureDelta objTemperatureDelta)) + if (obj is null || !(obj is TemperatureDelta objTemperatureDelta)) return false; return Equals(objTemperatureDelta); @@ -576,7 +576,7 @@ public bool Equals(TemperatureDelta other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(TemperatureDelta other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -606,7 +606,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(TemperatureDeltaUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -648,7 +648,7 @@ private double AsBaseUnit() private double AsBaseNumericType(TemperatureDeltaUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureGradient.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureGradient.g.cs index 3f3297007e..1c9647ae53 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureGradient.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureGradient.g.cs @@ -79,7 +79,7 @@ public TemperatureGradient() /// If value is NaN or Infinity. private TemperatureGradient(double value, TemperatureGradientUnit unit) { - if(unit == TemperatureGradientUnit.Undefined) + if (unit == TemperatureGradientUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -428,8 +428,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is TemperatureGradient objTemperatureGradient)) throw new ArgumentException("Expected type TemperatureGradient.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is TemperatureGradient objTemperatureGradient)) throw new ArgumentException("Expected type TemperatureGradient.", nameof(obj)); return CompareTo(objTemperatureGradient); } @@ -443,7 +443,7 @@ internal int CompareTo(TemperatureGradient other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is TemperatureGradient objTemperatureGradient)) + if (obj is null || !(obj is TemperatureGradient objTemperatureGradient)) return false; return Equals(objTemperatureGradient); @@ -496,7 +496,7 @@ public bool Equals(TemperatureGradient other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(TemperatureGradient other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -526,7 +526,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(TemperatureGradientUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -563,7 +563,7 @@ private double AsBaseUnit() private double AsBaseNumericType(TemperatureGradientUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.g.cs index bf7ae790fe..4d4cad0df3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.g.cs @@ -82,7 +82,7 @@ public ThermalConductivity() /// If value is NaN or Infinity. private ThermalConductivity(double value, ThermalConductivityUnit unit) { - if(unit == ThermalConductivityUnit.Undefined) + if (unit == ThermalConductivityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -399,8 +399,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ThermalConductivity objThermalConductivity)) throw new ArgumentException("Expected type ThermalConductivity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ThermalConductivity objThermalConductivity)) throw new ArgumentException("Expected type ThermalConductivity.", nameof(obj)); return CompareTo(objThermalConductivity); } @@ -414,7 +414,7 @@ internal int CompareTo(ThermalConductivity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ThermalConductivity objThermalConductivity)) + if (obj is null || !(obj is ThermalConductivity objThermalConductivity)) return false; return Equals(objThermalConductivity); @@ -467,7 +467,7 @@ public bool Equals(ThermalConductivity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ThermalConductivity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -497,7 +497,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ThermalConductivityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -532,7 +532,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ThermalConductivityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.g.cs index 2ac6132885..22a6aec464 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.g.cs @@ -79,7 +79,7 @@ public ThermalResistance() /// If value is NaN or Infinity. private ThermalResistance(double value, ThermalResistanceUnit unit) { - if(unit == ThermalResistanceUnit.Undefined) + if (unit == ThermalResistanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -460,8 +460,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ThermalResistance objThermalResistance)) throw new ArgumentException("Expected type ThermalResistance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ThermalResistance objThermalResistance)) throw new ArgumentException("Expected type ThermalResistance.", nameof(obj)); return CompareTo(objThermalResistance); } @@ -475,7 +475,7 @@ internal int CompareTo(ThermalResistance other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is ThermalResistance objThermalResistance)) + if (obj is null || !(obj is ThermalResistance objThermalResistance)) return false; return Equals(objThermalResistance); @@ -528,7 +528,7 @@ public bool Equals(ThermalResistance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ThermalResistance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -558,7 +558,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ThermalResistanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -597,7 +597,7 @@ private double AsBaseUnit() private double AsBaseNumericType(ThermalResistanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.g.cs index e26292e300..594afa7c42 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.g.cs @@ -79,7 +79,7 @@ public Torque() /// If value is NaN or Infinity. private Torque(double value, TorqueUnit unit) { - if(unit == TorqueUnit.Undefined) + if (unit == TorqueUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -767,8 +767,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Torque objTorque)) throw new ArgumentException("Expected type Torque.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Torque objTorque)) throw new ArgumentException("Expected type Torque.", nameof(obj)); return CompareTo(objTorque); } @@ -782,7 +782,7 @@ internal int CompareTo(Torque other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Torque objTorque)) + if (obj is null || !(obj is Torque objTorque)) return false; return Equals(objTorque); @@ -835,7 +835,7 @@ public bool Equals(Torque other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Torque other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -865,7 +865,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(TorqueUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -923,7 +923,7 @@ private double AsBaseUnit() private double AsBaseNumericType(TorqueUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TorquePerLength.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TorquePerLength.g.cs index 7568aead8f..745e3e971c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TorquePerLength.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TorquePerLength.g.cs @@ -79,7 +79,7 @@ public TorquePerLength() /// If value is NaN or Infinity. private TorquePerLength(double value, TorquePerLengthUnit unit) { - if(unit == TorquePerLengthUnit.Undefined) + if (unit == TorquePerLengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -703,8 +703,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is TorquePerLength objTorquePerLength)) throw new ArgumentException("Expected type TorquePerLength.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is TorquePerLength objTorquePerLength)) throw new ArgumentException("Expected type TorquePerLength.", nameof(obj)); return CompareTo(objTorquePerLength); } @@ -718,7 +718,7 @@ internal int CompareTo(TorquePerLength other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is TorquePerLength objTorquePerLength)) + if (obj is null || !(obj is TorquePerLength objTorquePerLength)) return false; return Equals(objTorquePerLength); @@ -771,7 +771,7 @@ public bool Equals(TorquePerLength other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(TorquePerLength other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -801,7 +801,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(TorquePerLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -855,7 +855,7 @@ private double AsBaseUnit() private double AsBaseNumericType(TorquePerLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Turbidity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Turbidity.g.cs index 8f2f5ea942..6a8379c825 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Turbidity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Turbidity.g.cs @@ -82,7 +82,7 @@ public Turbidity() /// If value is NaN or Infinity. private Turbidity(double value, TurbidityUnit unit) { - if(unit == TurbidityUnit.Undefined) + if (unit == TurbidityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -383,8 +383,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Turbidity objTurbidity)) throw new ArgumentException("Expected type Turbidity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Turbidity objTurbidity)) throw new ArgumentException("Expected type Turbidity.", nameof(obj)); return CompareTo(objTurbidity); } @@ -398,7 +398,7 @@ internal int CompareTo(Turbidity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Turbidity objTurbidity)) + if (obj is null || !(obj is Turbidity objTurbidity)) return false; return Equals(objTurbidity); @@ -451,7 +451,7 @@ public bool Equals(Turbidity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Turbidity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -481,7 +481,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(TurbidityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -515,7 +515,7 @@ private double AsBaseUnit() private double AsBaseNumericType(TurbidityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.g.cs index e8a90a7878..f49e5263fe 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.g.cs @@ -79,7 +79,7 @@ public VitaminA() /// If value is NaN or Infinity. private VitaminA(double value, VitaminAUnit unit) { - if(unit == VitaminAUnit.Undefined) + if (unit == VitaminAUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -380,8 +380,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VitaminA objVitaminA)) throw new ArgumentException("Expected type VitaminA.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is VitaminA objVitaminA)) throw new ArgumentException("Expected type VitaminA.", nameof(obj)); return CompareTo(objVitaminA); } @@ -395,7 +395,7 @@ internal int CompareTo(VitaminA other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is VitaminA objVitaminA)) + if (obj is null || !(obj is VitaminA objVitaminA)) return false; return Equals(objVitaminA); @@ -448,7 +448,7 @@ public bool Equals(VitaminA other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(VitaminA other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -478,7 +478,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(VitaminAUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -512,7 +512,7 @@ private double AsBaseUnit() private double AsBaseNumericType(VitaminAUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.g.cs index b33e009b99..7b0f42d730 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.g.cs @@ -79,7 +79,7 @@ public Volume() /// If value is NaN or Infinity. private Volume(double value, VolumeUnit unit) { - if(unit == VolumeUnit.Undefined) + if (unit == VolumeUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -1226,8 +1226,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Volume objVolume)) throw new ArgumentException("Expected type Volume.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Volume objVolume)) throw new ArgumentException("Expected type Volume.", nameof(obj)); return CompareTo(objVolume); } @@ -1241,7 +1241,7 @@ internal int CompareTo(Volume other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is Volume objVolume)) + if (obj is null || !(obj is Volume objVolume)) return false; return Equals(objVolume); @@ -1294,7 +1294,7 @@ public bool Equals(Volume other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Volume other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1324,7 +1324,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(VolumeUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -1408,7 +1408,7 @@ private double AsBaseUnit() private double AsBaseNumericType(VolumeUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeConcentration.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeConcentration.g.cs index 83ff637cd1..5a3448ad5e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeConcentration.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeConcentration.g.cs @@ -82,7 +82,7 @@ public VolumeConcentration() /// If value is NaN or Infinity. private VolumeConcentration(double value, VolumeConcentrationUnit unit) { - if(unit == VolumeConcentrationUnit.Undefined) + if (unit == VolumeConcentrationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -687,8 +687,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumeConcentration objVolumeConcentration)) throw new ArgumentException("Expected type VolumeConcentration.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is VolumeConcentration objVolumeConcentration)) throw new ArgumentException("Expected type VolumeConcentration.", nameof(obj)); return CompareTo(objVolumeConcentration); } @@ -702,7 +702,7 @@ internal int CompareTo(VolumeConcentration other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is VolumeConcentration objVolumeConcentration)) + if (obj is null || !(obj is VolumeConcentration objVolumeConcentration)) return false; return Equals(objVolumeConcentration); @@ -755,7 +755,7 @@ public bool Equals(VolumeConcentration other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(VolumeConcentration other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -785,7 +785,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(VolumeConcentrationUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -838,7 +838,7 @@ private double AsBaseUnit() private double AsBaseNumericType(VolumeConcentrationUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.g.cs index 2e06611e16..83d9475d67 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -79,7 +79,7 @@ public VolumeFlow() /// If value is NaN or Infinity. private VolumeFlow(double value, VolumeFlowUnit unit) { - if(unit == VolumeFlowUnit.Undefined) + if (unit == VolumeFlowUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -1383,8 +1383,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumeFlow objVolumeFlow)) throw new ArgumentException("Expected type VolumeFlow.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is VolumeFlow objVolumeFlow)) throw new ArgumentException("Expected type VolumeFlow.", nameof(obj)); return CompareTo(objVolumeFlow); } @@ -1398,7 +1398,7 @@ internal int CompareTo(VolumeFlow other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is VolumeFlow objVolumeFlow)) + if (obj is null || !(obj is VolumeFlow objVolumeFlow)) return false; return Equals(objVolumeFlow); @@ -1451,7 +1451,7 @@ public bool Equals(VolumeFlow other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(VolumeFlow other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1481,7 +1481,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(VolumeFlowUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -1576,7 +1576,7 @@ private double AsBaseUnit() private double AsBaseNumericType(VolumeFlowUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs index 5c5f6e3c49..853af9bc31 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs @@ -79,7 +79,7 @@ public VolumeFlowPerArea() /// If value is NaN or Infinity. private VolumeFlowPerArea(double value, VolumeFlowPerAreaUnit unit) { - if(unit == VolumeFlowPerAreaUnit.Undefined) + if (unit == VolumeFlowPerAreaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -396,8 +396,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumeFlowPerArea objVolumeFlowPerArea)) throw new ArgumentException("Expected type VolumeFlowPerArea.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is VolumeFlowPerArea objVolumeFlowPerArea)) throw new ArgumentException("Expected type VolumeFlowPerArea.", nameof(obj)); return CompareTo(objVolumeFlowPerArea); } @@ -411,7 +411,7 @@ internal int CompareTo(VolumeFlowPerArea other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is VolumeFlowPerArea objVolumeFlowPerArea)) + if (obj is null || !(obj is VolumeFlowPerArea objVolumeFlowPerArea)) return false; return Equals(objVolumeFlowPerArea); @@ -464,7 +464,7 @@ public bool Equals(VolumeFlowPerArea other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(VolumeFlowPerArea other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -494,7 +494,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(VolumeFlowPerAreaUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -529,7 +529,7 @@ private double AsBaseUnit() private double AsBaseNumericType(VolumeFlowPerAreaUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumePerLength.g.cs index f186b08eb4..ebb807a4af 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -79,7 +79,7 @@ public VolumePerLength() /// If value is NaN or Infinity. private VolumePerLength(double value, VolumePerLengthUnit unit) { - if(unit == VolumePerLengthUnit.Undefined) + if (unit == VolumePerLengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -476,8 +476,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumePerLength objVolumePerLength)) throw new ArgumentException("Expected type VolumePerLength.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is VolumePerLength objVolumePerLength)) throw new ArgumentException("Expected type VolumePerLength.", nameof(obj)); return CompareTo(objVolumePerLength); } @@ -491,7 +491,7 @@ internal int CompareTo(VolumePerLength other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is VolumePerLength objVolumePerLength)) + if (obj is null || !(obj is VolumePerLength objVolumePerLength)) return false; return Equals(objVolumePerLength); @@ -544,7 +544,7 @@ public bool Equals(VolumePerLength other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(VolumePerLength other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -574,7 +574,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(VolumePerLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -614,7 +614,7 @@ private double AsBaseUnit() private double AsBaseNumericType(VolumePerLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs index 6590ccbfbb..4bdcb134bf 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs @@ -82,7 +82,7 @@ public VolumetricHeatCapacity() /// If value is NaN or Infinity. private VolumetricHeatCapacity(double value, VolumetricHeatCapacityUnit unit) { - if(unit == VolumetricHeatCapacityUnit.Undefined) + if (unit == VolumetricHeatCapacityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -511,8 +511,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumetricHeatCapacity objVolumetricHeatCapacity)) throw new ArgumentException("Expected type VolumetricHeatCapacity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is VolumetricHeatCapacity objVolumetricHeatCapacity)) throw new ArgumentException("Expected type VolumetricHeatCapacity.", nameof(obj)); return CompareTo(objVolumetricHeatCapacity); } @@ -526,7 +526,7 @@ internal int CompareTo(VolumetricHeatCapacity other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is VolumetricHeatCapacity objVolumetricHeatCapacity)) + if (obj is null || !(obj is VolumetricHeatCapacity objVolumetricHeatCapacity)) return false; return Equals(objVolumetricHeatCapacity); @@ -579,7 +579,7 @@ public bool Equals(VolumetricHeatCapacity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(VolumetricHeatCapacity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -609,7 +609,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(VolumetricHeatCapacityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -651,7 +651,7 @@ private double AsBaseUnit() private double AsBaseNumericType(VolumetricHeatCapacityUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs index 679dffaedb..cf8d3dfd43 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs @@ -79,7 +79,7 @@ public WarpingMomentOfInertia() /// If value is NaN or Infinity. private WarpingMomentOfInertia(double value, WarpingMomentOfInertiaUnit unit) { - if(unit == WarpingMomentOfInertiaUnit.Undefined) + if (unit == WarpingMomentOfInertiaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -460,8 +460,8 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is WarpingMomentOfInertia objWarpingMomentOfInertia)) throw new ArgumentException("Expected type WarpingMomentOfInertia.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is WarpingMomentOfInertia objWarpingMomentOfInertia)) throw new ArgumentException("Expected type WarpingMomentOfInertia.", nameof(obj)); return CompareTo(objWarpingMomentOfInertia); } @@ -475,7 +475,7 @@ internal int CompareTo(WarpingMomentOfInertia other) [Windows.Foundation.Metadata.DefaultOverload] public override bool Equals(object obj) { - if(obj is null || !(obj is WarpingMomentOfInertia objWarpingMomentOfInertia)) + if (obj is null || !(obj is WarpingMomentOfInertia objWarpingMomentOfInertia)) return false; return Equals(objWarpingMomentOfInertia); @@ -528,7 +528,7 @@ public bool Equals(WarpingMomentOfInertia other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(WarpingMomentOfInertia other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -558,7 +558,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(WarpingMomentOfInertiaUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = AsBaseNumericType(unit); @@ -597,7 +597,7 @@ private double AsBaseUnit() private double AsBaseNumericType(WarpingMomentOfInertiaUnit unit) { - if(Unit == unit) + if (Unit == unit) return _value; var baseUnitValue = AsBaseUnit(); diff --git a/UnitsNet/BaseDimensions.cs b/UnitsNet/BaseDimensions.cs index 1b2f8c70ff..295ac84b34 100644 --- a/UnitsNet/BaseDimensions.cs +++ b/UnitsNet/BaseDimensions.cs @@ -56,7 +56,7 @@ public bool IsDimensionless() /// public override bool Equals(object obj) { - if(obj is null || !(obj is BaseDimensions)) + if (obj is null || !(obj is BaseDimensions)) return false; var other = (BaseDimensions)obj; @@ -83,7 +83,7 @@ public override int GetHashCode() /// Resulting dimensions. public BaseDimensions Multiply(BaseDimensions right) { - if(right is null) + if (right is null) throw new ArgumentNullException(nameof(right)); return new BaseDimensions( @@ -103,7 +103,7 @@ public BaseDimensions Multiply(BaseDimensions right) /// Resulting dimensions. public BaseDimensions Divide(BaseDimensions right) { - if(right is null) + if (right is null) throw new ArgumentNullException(nameof(right)); return new BaseDimensions( @@ -146,9 +146,9 @@ public BaseDimensions Divide(BaseDimensions right) /// Resulting dimensions. public static BaseDimensions operator *(BaseDimensions left, BaseDimensions right) { - if(left is null) + if (left is null) throw new ArgumentNullException(nameof(left)); - else if(right is null) + else if (right is null) throw new ArgumentNullException(nameof(right)); return left.Multiply(right); @@ -162,9 +162,9 @@ public BaseDimensions Divide(BaseDimensions right) /// Resulting dimensions. public static BaseDimensions operator /(BaseDimensions left, BaseDimensions right) { - if(left is null) + if (left is null) throw new ArgumentNullException(nameof(left)); - else if(right is null) + else if (right is null) throw new ArgumentNullException(nameof(right)); return left.Divide(right); @@ -190,11 +190,11 @@ private static void AppendDimensionString(StringBuilder sb, string name, int val { var absoluteValue = Math.Abs(value); - if(absoluteValue > 0) + if (absoluteValue > 0) { sb.AppendFormat("[{0}]", name); - if(absoluteValue > 1) + if (absoluteValue > 1) sb.AppendFormat("^{0}", value); } } diff --git a/UnitsNet/BaseUnits.cs b/UnitsNet/BaseUnits.cs index cfcf559eb1..cafc37e7c0 100644 --- a/UnitsNet/BaseUnits.cs +++ b/UnitsNet/BaseUnits.cs @@ -59,7 +59,7 @@ public BaseUnits( /// public override bool Equals(object obj) { - if(obj is null || !(obj is BaseUnits)) + if (obj is null || !(obj is BaseUnits)) return false; return Equals((BaseUnits)obj); @@ -72,7 +72,7 @@ public override bool Equals(object obj) /// True if equal, otherwise false. public bool Equals(BaseUnits other) { - if(other is null) + if (other is null) return false; return Length == other.Length && @@ -93,11 +93,11 @@ public bool Equals(BaseUnits other) /// True if the base units are a subset of other, otherwise false. public bool IsSubsetOf(BaseUnits other) { - if(other is null) + if (other is null) return false; // If all base units are undefined, can only be a subset of another where all base units are undefined. - if(Equals(Undefined)) + if (Equals(Undefined)) return other.Equals(Undefined); return (Length == LengthUnit.Undefined || Length == other.Length) && diff --git a/UnitsNet/CustomCode/Quantities/Duration.extra.cs b/UnitsNet/CustomCode/Quantities/Duration.extra.cs index 8af3e71c2a..a7f1f94fbd 100644 --- a/UnitsNet/CustomCode/Quantities/Duration.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Duration.extra.cs @@ -15,7 +15,7 @@ public partial struct Duration /// The TimeSpan with the same time as the duration public TimeSpan ToTimeSpan() { - if( Seconds > TimeSpan.MaxValue.TotalSeconds || + if ( Seconds > TimeSpan.MaxValue.TotalSeconds || Seconds < TimeSpan.MinValue.TotalSeconds ) throw new ArgumentOutOfRangeException( nameof( Duration ), "The duration is too large or small to fit in a TimeSpan" ); return TimeSpan.FromSeconds( Seconds ); diff --git a/UnitsNet/CustomCode/Quantities/ElectricConductivity.extra.cs b/UnitsNet/CustomCode/Quantities/ElectricConductivity.extra.cs index 766f78c677..120fae5701 100644 --- a/UnitsNet/CustomCode/Quantities/ElectricConductivity.extra.cs +++ b/UnitsNet/CustomCode/Quantities/ElectricConductivity.extra.cs @@ -13,7 +13,7 @@ public partial struct ElectricConductivity /// The inverse or of this unit. public ElectricResistivity Inverse() { - if( SiemensPerMeter == 0.0 ) + if (SiemensPerMeter == 0.0) return new ElectricResistivity( 0.0, ElectricResistivityUnit.OhmMeter ); return new ElectricResistivity( 1 / SiemensPerMeter, ElectricResistivityUnit.OhmMeter ); diff --git a/UnitsNet/CustomCode/Quantities/ElectricResistivity.extra.cs b/UnitsNet/CustomCode/Quantities/ElectricResistivity.extra.cs index a58e80c8a9..f53482d9f2 100644 --- a/UnitsNet/CustomCode/Quantities/ElectricResistivity.extra.cs +++ b/UnitsNet/CustomCode/Quantities/ElectricResistivity.extra.cs @@ -13,7 +13,7 @@ public partial struct ElectricResistivity /// The inverse or of this unit. public ElectricConductivity Inverse() { - if( OhmMeters == 0.0 ) + if (OhmMeters == 0.0) return new ElectricConductivity( 0, ElectricConductivityUnit.SiemensPerMeter ); return new ElectricConductivity( 1 / OhmMeters, ElectricConductivityUnit.SiemensPerMeter ); diff --git a/UnitsNet/CustomCode/Quantities/Length.extra.cs b/UnitsNet/CustomCode/Quantities/Length.extra.cs index 1d7c8922c0..df0510caa3 100644 --- a/UnitsNet/CustomCode/Quantities/Length.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Length.extra.cs @@ -115,7 +115,7 @@ public static bool TryParseFeetInches(string? str, out Length result, IFormatPro { result = feet + inches; - if(negativeSignGroup.Length > 0) + if (negativeSignGroup.Length > 0) result = -result; return true; diff --git a/UnitsNet/CustomCode/QuantityParser.cs b/UnitsNet/CustomCode/QuantityParser.cs index a0054f5779..8e5db0b810 100644 --- a/UnitsNet/CustomCode/QuantityParser.cs +++ b/UnitsNet/CustomCode/QuantityParser.cs @@ -79,14 +79,14 @@ internal bool TryParse(string? str, { result = default; - if(string.IsNullOrWhiteSpace(str)) return false; + if (string.IsNullOrWhiteSpace(str)) return false; str = str!.Trim(); var numFormat = formatProvider != null ? (NumberFormatInfo) formatProvider.GetFormat(typeof(NumberFormatInfo)) : NumberFormatInfo.CurrentInfo; - if(numFormat == null) + if (numFormat == null) return false; var regex = CreateRegexForQuantity(formatProvider); diff --git a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs index 42fe0cdcb1..e5e4817487 100644 --- a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs +++ b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs @@ -186,18 +186,18 @@ public string GetDefaultAbbreviation(TUnitType unit, IFormatProvider? { var unitType = typeof(TUnitType); - if(!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup)) + if (!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup)) { - if(formatProvider != FallbackCulture) + if (formatProvider != FallbackCulture) return GetDefaultAbbreviation(unit, FallbackCulture); else throw new NotImplementedException($"No abbreviation is specified for {unitType.Name}.{unit}"); } var abbreviations = lookup!.GetAbbreviationsForUnit(unit); - if(abbreviations.Count == 0) + if (abbreviations.Count == 0) { - if(formatProvider != FallbackCulture) + if (formatProvider != FallbackCulture) return GetDefaultAbbreviation(unit, FallbackCulture); else throw new NotImplementedException($"No abbreviation is specified for {unitType.Name}.{unit}"); @@ -218,18 +218,18 @@ public string GetDefaultAbbreviation(TUnitType unit, IFormatProvider? [PublicAPI] public string GetDefaultAbbreviation(Type unitType, int unitValue, IFormatProvider? formatProvider = null) { - if(!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup)) + if (!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup)) { - if(formatProvider != FallbackCulture) + if (formatProvider != FallbackCulture) return GetDefaultAbbreviation(unitType, unitValue, FallbackCulture); else throw new NotImplementedException($"No abbreviation is specified for {unitType.Name}.{Enum.GetName(unitType, unitValue)}."); } var abbreviations = lookup!.GetAbbreviationsForUnit(unitValue); - if(abbreviations.Count == 0) + if (abbreviations.Count == 0) { - if(formatProvider != FallbackCulture) + if (formatProvider != FallbackCulture) return GetDefaultAbbreviation(unitType, unitValue, FallbackCulture); else throw new NotImplementedException($"No abbreviation is specified for {unitType.Name}.{Enum.GetName(unitType, unitValue)}."); @@ -263,11 +263,11 @@ public string[] GetUnitAbbreviations(Type unitType, int unitValue, IFormatProvid { formatProvider = formatProvider ?? CultureInfo.CurrentUICulture; - if(!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup)) + if (!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup)) return formatProvider != FallbackCulture ? GetUnitAbbreviations(unitType, unitValue, FallbackCulture) : new string[] { }; var abbreviations = lookup!.GetAbbreviationsForUnit(unitValue); - if(abbreviations.Count == 0) + if (abbreviations.Count == 0) return formatProvider != FallbackCulture ? GetUnitAbbreviations(unitType, unitValue, FallbackCulture) : new string[] { }; return abbreviations.ToArray(); @@ -284,7 +284,7 @@ public string[] GetAllUnitAbbreviationsForQuantity(Type unitEnumType, IFormatPro { formatProvider = formatProvider ?? CultureInfo.CurrentUICulture; - if(!TryGetUnitValueAbbreviationLookup(unitEnumType, formatProvider, out var lookup)) + if (!TryGetUnitValueAbbreviationLookup(unitEnumType, formatProvider, out var lookup)) return formatProvider != FallbackCulture ? GetAllUnitAbbreviationsForQuantity(unitEnumType, FallbackCulture) : new string[] { }; return lookup!.GetAllUnitAbbreviationsForQuantity(); @@ -296,10 +296,10 @@ internal bool TryGetUnitValueAbbreviationLookup(Type unitType, IFormatProvider? formatProvider = formatProvider ?? CultureInfo.CurrentUICulture; - if(!_lookupsForCulture.TryGetValue(formatProvider, out var quantitiesForProvider)) + if (!_lookupsForCulture.TryGetValue(formatProvider, out var quantitiesForProvider)) return formatProvider != FallbackCulture ? TryGetUnitValueAbbreviationLookup(unitType, FallbackCulture, out unitToAbbreviations) : false; - if(!quantitiesForProvider.TryGetValue(unitType, out unitToAbbreviations)) + if (!quantitiesForProvider.TryGetValue(unitType, out unitToAbbreviations)) return formatProvider != FallbackCulture ? TryGetUnitValueAbbreviationLookup(unitType, FallbackCulture, out unitToAbbreviations) : false; return true; diff --git a/UnitsNet/CustomCode/UnitParser.cs b/UnitsNet/CustomCode/UnitParser.cs index 2becb1fd4d..a80b2b931f 100644 --- a/UnitsNet/CustomCode/UnitParser.cs +++ b/UnitsNet/CustomCode/UnitParser.cs @@ -72,7 +72,7 @@ public Enum Parse([NotNull] string unitAbbreviation, Type unitType, IFormatProvi if (unitAbbreviation == null) throw new ArgumentNullException(nameof(unitAbbreviation)); unitAbbreviation = unitAbbreviation.Trim(); - if(!_unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations)) + if (!_unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations)) throw new UnitNotFoundException($"No abbreviations defined for unit type [{unitType}] for culture [{formatProvider}]."); var unitIntValues = abbreviations!.GetUnitsForAbbreviation(unitAbbreviation, ignoreCase: true); @@ -157,7 +157,7 @@ public bool TryParse(string? unitAbbreviation, IFormatProvider? forma { unit = default; - if(!TryParse(unitAbbreviation, typeof(TUnitType), formatProvider, out var unitObj)) + if (!TryParse(unitAbbreviation, typeof(TUnitType), formatProvider, out var unitObj)) return false; unit = (TUnitType)unitObj!; @@ -197,7 +197,7 @@ public bool TryParse(string? unitAbbreviation, Type unitType, IFormatProvider? f unitAbbreviation = unitAbbreviation.Trim(); unit = default; - if(!_unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations)) + if (!_unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations)) return false; var unitIntValues = abbreviations!.GetUnitsForAbbreviation(unitAbbreviation, ignoreCase: true); @@ -212,7 +212,7 @@ public bool TryParse(string? unitAbbreviation, Type unitType, IFormatProvider? f if (unitIntValues.Count > 1) unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation, ignoreCase: false); - if(unitIntValues.Count != 1) + if (unitIntValues.Count != 1) return false; unit = (Enum)Enum.ToObject(unitType, unitIntValues[0]); diff --git a/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs b/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs index cfa816bc81..3e41efb2f8 100644 --- a/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs +++ b/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs @@ -31,7 +31,7 @@ internal List GetAbbreviationsForUnit(UnitType unit) where Uni internal List GetAbbreviationsForUnit(int unit) { - if(!unitToAbbreviationMap.TryGetValue(unit, out var abbreviations)) + if (!unitToAbbreviationMap.TryGetValue(unit, out var abbreviations)) unitToAbbreviationMap[unit] = abbreviations = new List(); return abbreviations.Distinct().ToList(); @@ -43,7 +43,7 @@ internal List GetUnitsForAbbreviation(string abbreviation, bool ignoreCase) var key = ignoreCase ? lowerCaseAbbreviation : abbreviation; var map = ignoreCase ? lowerCaseAbbreviationToUnitMap : abbreviationToUnitMap; - if(!map.TryGetValue(key, out List units)) + if (!map.TryGetValue(key, out List units)) map[key] = units = new List(); return units.Distinct().ToList(); @@ -53,15 +53,15 @@ internal void Add(int unit, string abbreviation, bool setAsDefault = false, bool { var lowerCaseAbbreviation = abbreviation.ToLower(); - if(!unitToAbbreviationMap.TryGetValue(unit, out var abbreviationsForUnit)) + if (!unitToAbbreviationMap.TryGetValue(unit, out var abbreviationsForUnit)) abbreviationsForUnit = unitToAbbreviationMap[unit] = new List(); - if(allowAbbreviationLookup) + if (allowAbbreviationLookup) { - if(!abbreviationToUnitMap.TryGetValue(abbreviation, out var unitsForAbbreviation)) + if (!abbreviationToUnitMap.TryGetValue(abbreviation, out var unitsForAbbreviation)) abbreviationToUnitMap[abbreviation] = unitsForAbbreviation = new List(); - if(!lowerCaseAbbreviationToUnitMap.TryGetValue(lowerCaseAbbreviation, out var unitsForLowerCaseAbbreviation)) + if (!lowerCaseAbbreviationToUnitMap.TryGetValue(lowerCaseAbbreviation, out var unitsForLowerCaseAbbreviation)) lowerCaseAbbreviationToUnitMap[lowerCaseAbbreviation] = unitsForLowerCaseAbbreviation = new List(); unitsForLowerCaseAbbreviation.Remove(unit); diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs index 62ffdca0cc..cab30f8fbe 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs @@ -92,7 +92,7 @@ static Acceleration() /// If value is NaN or Infinity. public Acceleration(double value, AccelerationUnit unit) { - if(unit == AccelerationUnit.Undefined) + if (unit == AccelerationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -109,7 +109,7 @@ public Acceleration(double value, AccelerationUnit unit) /// No unit was found for the given . public Acceleration(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -295,7 +295,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(AccelerationUnit.MeterPerSecondSquared, AccelerationUnit.MillistandardGravity, quantity => new Acceleration((quantity.Value/9.80665) / 1e-3d, AccelerationUnit.MillistandardGravity)); unitConverter.SetConversionFunction(AccelerationUnit.MeterPerSecondSquared, AccelerationUnit.NanometerPerSecondSquared, quantity => new Acceleration((quantity.Value) / 1e-9d, AccelerationUnit.NanometerPerSecondSquared)); unitConverter.SetConversionFunction(AccelerationUnit.MeterPerSecondSquared, AccelerationUnit.StandardGravity, quantity => new Acceleration(quantity.Value/9.80665, AccelerationUnit.StandardGravity)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(AccelerationUnit.MeterPerSecondSquared, AccelerationUnit.MeterPerSecondSquared, quantity => quantity); @@ -745,8 +744,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Accel /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Acceleration objAcceleration)) throw new ArgumentException("Expected type Acceleration.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Acceleration objAcceleration)) throw new ArgumentException("Expected type Acceleration.", nameof(obj)); return CompareTo(objAcceleration); } @@ -761,7 +760,7 @@ public int CompareTo(Acceleration other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Acceleration objAcceleration)) + if (obj is null || !(obj is Acceleration objAcceleration)) return false; return Equals(objAcceleration); @@ -816,7 +815,7 @@ public bool Equals(Acceleration other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Acceleration other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -844,7 +843,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(AccelerationUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -854,13 +853,13 @@ public double As(AccelerationUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -869,7 +868,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is AccelerationUnit unitAsAccelerationUnit)) + if (!(unit is AccelerationUnit unitAsAccelerationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AccelerationUnit)} is supported.", nameof(unit)); return As(unitAsAccelerationUnit); @@ -893,18 +892,18 @@ public Acceleration ToUnit(AccelerationUnit unit) /// A Acceleration with the specified unit. public Acceleration ToUnit(AccelerationUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Acceleration), Unit, typeof(Acceleration), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Acceleration), Unit, typeof(Acceleration), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Acceleration)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -919,7 +918,7 @@ public Acceleration ToUnit(AccelerationUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is AccelerationUnit unitAsAccelerationUnit)) + if (!(unit is AccelerationUnit unitAsAccelerationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AccelerationUnit)} is supported.", nameof(unit)); return ToUnit(unitAsAccelerationUnit, DefaultConversionFunctions); @@ -928,7 +927,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is AccelerationUnit unitAsAccelerationUnit)) + if (!(unit is AccelerationUnit unitAsAccelerationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AccelerationUnit)} is supported.", nameof(unit)); return ToUnit(unitAsAccelerationUnit, unitConverter); @@ -937,13 +936,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Acceleration ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1118,15 +1117,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Acceleration)) + if (conversionType == typeof(Acceleration)) return this; - else if(conversionType == typeof(AccelerationUnit)) + else if (conversionType == typeof(AccelerationUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Acceleration.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Acceleration.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Acceleration.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Acceleration)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs index 6f30d2c40e..623f3daefb 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -93,7 +93,7 @@ static AmountOfSubstance() /// If value is NaN or Infinity. public AmountOfSubstance(double value, AmountOfSubstanceUnit unit) { - if(unit == AmountOfSubstanceUnit.Undefined) + if (unit == AmountOfSubstanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -110,7 +110,7 @@ public AmountOfSubstance(double value, AmountOfSubstanceUnit unit) /// No unit was found for the given . public AmountOfSubstance(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -302,7 +302,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(AmountOfSubstanceUnit.Mole, AmountOfSubstanceUnit.Nanomole, quantity => new AmountOfSubstance((quantity.Value) / 1e-9d, AmountOfSubstanceUnit.Nanomole)); unitConverter.SetConversionFunction(AmountOfSubstanceUnit.Mole, AmountOfSubstanceUnit.NanopoundMole, quantity => new AmountOfSubstance((quantity.Value/453.59237) / 1e-9d, AmountOfSubstanceUnit.NanopoundMole)); unitConverter.SetConversionFunction(AmountOfSubstanceUnit.Mole, AmountOfSubstanceUnit.PoundMole, quantity => new AmountOfSubstance(quantity.Value/453.59237, AmountOfSubstanceUnit.PoundMole)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(AmountOfSubstanceUnit.Mole, AmountOfSubstanceUnit.Mole, quantity => quantity); @@ -749,8 +748,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Amoun /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AmountOfSubstance objAmountOfSubstance)) throw new ArgumentException("Expected type AmountOfSubstance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is AmountOfSubstance objAmountOfSubstance)) throw new ArgumentException("Expected type AmountOfSubstance.", nameof(obj)); return CompareTo(objAmountOfSubstance); } @@ -765,7 +764,7 @@ public int CompareTo(AmountOfSubstance other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is AmountOfSubstance objAmountOfSubstance)) + if (obj is null || !(obj is AmountOfSubstance objAmountOfSubstance)) return false; return Equals(objAmountOfSubstance); @@ -820,7 +819,7 @@ public bool Equals(AmountOfSubstance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(AmountOfSubstance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -848,7 +847,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(AmountOfSubstanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -858,13 +857,13 @@ public double As(AmountOfSubstanceUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -873,7 +872,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is AmountOfSubstanceUnit unitAsAmountOfSubstanceUnit)) + if (!(unit is AmountOfSubstanceUnit unitAsAmountOfSubstanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AmountOfSubstanceUnit)} is supported.", nameof(unit)); return As(unitAsAmountOfSubstanceUnit); @@ -897,18 +896,18 @@ public AmountOfSubstance ToUnit(AmountOfSubstanceUnit unit) /// A AmountOfSubstance with the specified unit. public AmountOfSubstance ToUnit(AmountOfSubstanceUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(AmountOfSubstance), Unit, typeof(AmountOfSubstance), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(AmountOfSubstance), Unit, typeof(AmountOfSubstance), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (AmountOfSubstance)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -923,7 +922,7 @@ public AmountOfSubstance ToUnit(AmountOfSubstanceUnit unit, UnitConverter unitCo /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is AmountOfSubstanceUnit unitAsAmountOfSubstanceUnit)) + if (!(unit is AmountOfSubstanceUnit unitAsAmountOfSubstanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AmountOfSubstanceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsAmountOfSubstanceUnit, DefaultConversionFunctions); @@ -932,7 +931,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is AmountOfSubstanceUnit unitAsAmountOfSubstanceUnit)) + if (!(unit is AmountOfSubstanceUnit unitAsAmountOfSubstanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AmountOfSubstanceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsAmountOfSubstanceUnit, unitConverter); @@ -941,13 +940,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public AmountOfSubstance ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1122,15 +1121,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(AmountOfSubstance)) + if (conversionType == typeof(AmountOfSubstance)) return this; - else if(conversionType == typeof(AmountOfSubstanceUnit)) + else if (conversionType == typeof(AmountOfSubstanceUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return AmountOfSubstance.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return AmountOfSubstance.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return AmountOfSubstance.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs index ebe3f3f7cd..1eae488487 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs @@ -82,7 +82,7 @@ static AmplitudeRatio() /// If value is NaN or Infinity. public AmplitudeRatio(double value, AmplitudeRatioUnit unit) { - if(unit == AmplitudeRatioUnit.Undefined) + if (unit == AmplitudeRatioUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public AmplitudeRatio(double value, AmplitudeRatioUnit unit) /// No unit was found for the given . public AmplitudeRatio(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -225,7 +225,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(AmplitudeRatioUnit.DecibelVolt, AmplitudeRatioUnit.DecibelMicrovolt, quantity => new AmplitudeRatio(quantity.Value + 120, AmplitudeRatioUnit.DecibelMicrovolt)); unitConverter.SetConversionFunction(AmplitudeRatioUnit.DecibelVolt, AmplitudeRatioUnit.DecibelMillivolt, quantity => new AmplitudeRatio(quantity.Value + 60, AmplitudeRatioUnit.DecibelMillivolt)); unitConverter.SetConversionFunction(AmplitudeRatioUnit.DecibelVolt, AmplitudeRatioUnit.DecibelUnloaded, quantity => new AmplitudeRatio(quantity.Value + 2.218487499, AmplitudeRatioUnit.DecibelUnloaded)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(AmplitudeRatioUnit.DecibelVolt, AmplitudeRatioUnit.DecibelVolt, quantity => quantity); @@ -559,8 +558,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Ampli /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AmplitudeRatio objAmplitudeRatio)) throw new ArgumentException("Expected type AmplitudeRatio.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is AmplitudeRatio objAmplitudeRatio)) throw new ArgumentException("Expected type AmplitudeRatio.", nameof(obj)); return CompareTo(objAmplitudeRatio); } @@ -575,7 +574,7 @@ public int CompareTo(AmplitudeRatio other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is AmplitudeRatio objAmplitudeRatio)) + if (obj is null || !(obj is AmplitudeRatio objAmplitudeRatio)) return false; return Equals(objAmplitudeRatio); @@ -630,7 +629,7 @@ public bool Equals(AmplitudeRatio other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(AmplitudeRatio other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -658,7 +657,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(AmplitudeRatioUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -668,13 +667,13 @@ public double As(AmplitudeRatioUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -683,7 +682,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is AmplitudeRatioUnit unitAsAmplitudeRatioUnit)) + if (!(unit is AmplitudeRatioUnit unitAsAmplitudeRatioUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AmplitudeRatioUnit)} is supported.", nameof(unit)); return As(unitAsAmplitudeRatioUnit); @@ -707,18 +706,18 @@ public AmplitudeRatio ToUnit(AmplitudeRatioUnit unit) /// A AmplitudeRatio with the specified unit. public AmplitudeRatio ToUnit(AmplitudeRatioUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(AmplitudeRatio), Unit, typeof(AmplitudeRatio), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(AmplitudeRatio), Unit, typeof(AmplitudeRatio), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (AmplitudeRatio)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -733,7 +732,7 @@ public AmplitudeRatio ToUnit(AmplitudeRatioUnit unit, UnitConverter unitConverte /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is AmplitudeRatioUnit unitAsAmplitudeRatioUnit)) + if (!(unit is AmplitudeRatioUnit unitAsAmplitudeRatioUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AmplitudeRatioUnit)} is supported.", nameof(unit)); return ToUnit(unitAsAmplitudeRatioUnit, DefaultConversionFunctions); @@ -742,7 +741,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is AmplitudeRatioUnit unitAsAmplitudeRatioUnit)) + if (!(unit is AmplitudeRatioUnit unitAsAmplitudeRatioUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AmplitudeRatioUnit)} is supported.", nameof(unit)); return ToUnit(unitAsAmplitudeRatioUnit, unitConverter); @@ -751,13 +750,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public AmplitudeRatio ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -932,15 +931,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(AmplitudeRatio)) + if (conversionType == typeof(AmplitudeRatio)) return this; - else if(conversionType == typeof(AmplitudeRatioUnit)) + else if (conversionType == typeof(AmplitudeRatioUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return AmplitudeRatio.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return AmplitudeRatio.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return AmplitudeRatio.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs index 93d02057c6..f02eefb745 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs @@ -94,7 +94,7 @@ static Angle() /// If value is NaN or Infinity. public Angle(double value, AngleUnit unit) { - if(unit == AngleUnit.Undefined) + if (unit == AngleUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -111,7 +111,7 @@ public Angle(double value, AngleUnit unit) /// No unit was found for the given . public Angle(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -309,7 +309,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(AngleUnit.Degree, AngleUnit.Radian, quantity => new Angle(quantity.Value/180*Math.PI, AngleUnit.Radian)); unitConverter.SetConversionFunction(AngleUnit.Degree, AngleUnit.Revolution, quantity => new Angle(quantity.Value/360, AngleUnit.Revolution)); unitConverter.SetConversionFunction(AngleUnit.Degree, AngleUnit.Tilt, quantity => new Angle(Math.Sin(quantity.Value/180*Math.PI), AngleUnit.Tilt)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(AngleUnit.Degree, AngleUnit.Degree, quantity => quantity); @@ -779,8 +778,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Angle /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Angle objAngle)) throw new ArgumentException("Expected type Angle.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Angle objAngle)) throw new ArgumentException("Expected type Angle.", nameof(obj)); return CompareTo(objAngle); } @@ -795,7 +794,7 @@ public int CompareTo(Angle other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Angle objAngle)) + if (obj is null || !(obj is Angle objAngle)) return false; return Equals(objAngle); @@ -850,7 +849,7 @@ public bool Equals(Angle other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Angle other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -878,7 +877,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(AngleUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -888,13 +887,13 @@ public double As(AngleUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -903,7 +902,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is AngleUnit unitAsAngleUnit)) + if (!(unit is AngleUnit unitAsAngleUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AngleUnit)} is supported.", nameof(unit)); return As(unitAsAngleUnit); @@ -927,18 +926,18 @@ public Angle ToUnit(AngleUnit unit) /// A Angle with the specified unit. public Angle ToUnit(AngleUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Angle), Unit, typeof(Angle), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Angle), Unit, typeof(Angle), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Angle)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -953,7 +952,7 @@ public Angle ToUnit(AngleUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is AngleUnit unitAsAngleUnit)) + if (!(unit is AngleUnit unitAsAngleUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AngleUnit)} is supported.", nameof(unit)); return ToUnit(unitAsAngleUnit, DefaultConversionFunctions); @@ -962,7 +961,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is AngleUnit unitAsAngleUnit)) + if (!(unit is AngleUnit unitAsAngleUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AngleUnit)} is supported.", nameof(unit)); return ToUnit(unitAsAngleUnit, unitConverter); @@ -971,13 +970,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Angle ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1152,15 +1151,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Angle)) + if (conversionType == typeof(Angle)) return this; - else if(conversionType == typeof(AngleUnit)) + else if (conversionType == typeof(AngleUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Angle.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Angle.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Angle.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Angle)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs index 5164b54dcb..234481f5b2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs @@ -81,7 +81,7 @@ static ApparentEnergy() /// If value is NaN or Infinity. public ApparentEnergy(double value, ApparentEnergyUnit unit) { - if(unit == ApparentEnergyUnit.Undefined) + if (unit == ApparentEnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -98,7 +98,7 @@ public ApparentEnergy(double value, ApparentEnergyUnit unit) /// No unit was found for the given . public ApparentEnergy(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -218,7 +218,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) // Register in unit converter: BaseUnit -> ApparentEnergyUnit unitConverter.SetConversionFunction(ApparentEnergyUnit.VoltampereHour, ApparentEnergyUnit.KilovoltampereHour, quantity => new ApparentEnergy((quantity.Value) / 1e3d, ApparentEnergyUnit.KilovoltampereHour)); unitConverter.SetConversionFunction(ApparentEnergyUnit.VoltampereHour, ApparentEnergyUnit.MegavoltampereHour, quantity => new ApparentEnergy((quantity.Value) / 1e6d, ApparentEnergyUnit.MegavoltampereHour)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ApparentEnergyUnit.VoltampereHour, ApparentEnergyUnit.VoltampereHour, quantity => quantity); @@ -533,8 +532,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Appar /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ApparentEnergy objApparentEnergy)) throw new ArgumentException("Expected type ApparentEnergy.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ApparentEnergy objApparentEnergy)) throw new ArgumentException("Expected type ApparentEnergy.", nameof(obj)); return CompareTo(objApparentEnergy); } @@ -549,7 +548,7 @@ public int CompareTo(ApparentEnergy other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ApparentEnergy objApparentEnergy)) + if (obj is null || !(obj is ApparentEnergy objApparentEnergy)) return false; return Equals(objApparentEnergy); @@ -604,7 +603,7 @@ public bool Equals(ApparentEnergy other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ApparentEnergy other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -632,7 +631,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ApparentEnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -642,13 +641,13 @@ public double As(ApparentEnergyUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -657,7 +656,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ApparentEnergyUnit unitAsApparentEnergyUnit)) + if (!(unit is ApparentEnergyUnit unitAsApparentEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ApparentEnergyUnit)} is supported.", nameof(unit)); return As(unitAsApparentEnergyUnit); @@ -681,18 +680,18 @@ public ApparentEnergy ToUnit(ApparentEnergyUnit unit) /// A ApparentEnergy with the specified unit. public ApparentEnergy ToUnit(ApparentEnergyUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ApparentEnergy), Unit, typeof(ApparentEnergy), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ApparentEnergy), Unit, typeof(ApparentEnergy), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ApparentEnergy)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -707,7 +706,7 @@ public ApparentEnergy ToUnit(ApparentEnergyUnit unit, UnitConverter unitConverte /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ApparentEnergyUnit unitAsApparentEnergyUnit)) + if (!(unit is ApparentEnergyUnit unitAsApparentEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ApparentEnergyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsApparentEnergyUnit, DefaultConversionFunctions); @@ -716,7 +715,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ApparentEnergyUnit unitAsApparentEnergyUnit)) + if (!(unit is ApparentEnergyUnit unitAsApparentEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ApparentEnergyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsApparentEnergyUnit, unitConverter); @@ -725,13 +724,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ApparentEnergy ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -906,15 +905,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ApparentEnergy)) + if (conversionType == typeof(ApparentEnergy)) return this; - else if(conversionType == typeof(ApparentEnergyUnit)) + else if (conversionType == typeof(ApparentEnergyUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ApparentEnergy.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ApparentEnergy.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ApparentEnergy.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs index 79b385058c..cc97ab6fec 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs @@ -82,7 +82,7 @@ static ApparentPower() /// If value is NaN or Infinity. public ApparentPower(double value, ApparentPowerUnit unit) { - if(unit == ApparentPowerUnit.Undefined) + if (unit == ApparentPowerUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public ApparentPower(double value, ApparentPowerUnit unit) /// No unit was found for the given . public ApparentPower(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -225,7 +225,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ApparentPowerUnit.Voltampere, ApparentPowerUnit.Gigavoltampere, quantity => new ApparentPower((quantity.Value) / 1e9d, ApparentPowerUnit.Gigavoltampere)); unitConverter.SetConversionFunction(ApparentPowerUnit.Voltampere, ApparentPowerUnit.Kilovoltampere, quantity => new ApparentPower((quantity.Value) / 1e3d, ApparentPowerUnit.Kilovoltampere)); unitConverter.SetConversionFunction(ApparentPowerUnit.Voltampere, ApparentPowerUnit.Megavoltampere, quantity => new ApparentPower((quantity.Value) / 1e6d, ApparentPowerUnit.Megavoltampere)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ApparentPowerUnit.Voltampere, ApparentPowerUnit.Voltampere, quantity => quantity); @@ -551,8 +550,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Appar /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ApparentPower objApparentPower)) throw new ArgumentException("Expected type ApparentPower.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ApparentPower objApparentPower)) throw new ArgumentException("Expected type ApparentPower.", nameof(obj)); return CompareTo(objApparentPower); } @@ -567,7 +566,7 @@ public int CompareTo(ApparentPower other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ApparentPower objApparentPower)) + if (obj is null || !(obj is ApparentPower objApparentPower)) return false; return Equals(objApparentPower); @@ -622,7 +621,7 @@ public bool Equals(ApparentPower other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ApparentPower other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -650,7 +649,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ApparentPowerUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -660,13 +659,13 @@ public double As(ApparentPowerUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -675,7 +674,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ApparentPowerUnit unitAsApparentPowerUnit)) + if (!(unit is ApparentPowerUnit unitAsApparentPowerUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ApparentPowerUnit)} is supported.", nameof(unit)); return As(unitAsApparentPowerUnit); @@ -699,18 +698,18 @@ public ApparentPower ToUnit(ApparentPowerUnit unit) /// A ApparentPower with the specified unit. public ApparentPower ToUnit(ApparentPowerUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ApparentPower), Unit, typeof(ApparentPower), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ApparentPower), Unit, typeof(ApparentPower), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ApparentPower)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -725,7 +724,7 @@ public ApparentPower ToUnit(ApparentPowerUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ApparentPowerUnit unitAsApparentPowerUnit)) + if (!(unit is ApparentPowerUnit unitAsApparentPowerUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ApparentPowerUnit)} is supported.", nameof(unit)); return ToUnit(unitAsApparentPowerUnit, DefaultConversionFunctions); @@ -734,7 +733,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ApparentPowerUnit unitAsApparentPowerUnit)) + if (!(unit is ApparentPowerUnit unitAsApparentPowerUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ApparentPowerUnit)} is supported.", nameof(unit)); return ToUnit(unitAsApparentPowerUnit, unitConverter); @@ -743,13 +742,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ApparentPower ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -924,15 +923,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ApparentPower)) + if (conversionType == typeof(ApparentPower)) return this; - else if(conversionType == typeof(ApparentPowerUnit)) + else if (conversionType == typeof(ApparentPowerUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ApparentPower.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ApparentPower.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ApparentPower.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ApparentPower)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs index 7989a90f51..1dcce12230 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs @@ -92,7 +92,7 @@ static Area() /// If value is NaN or Infinity. public Area(double value, AreaUnit unit) { - if(unit == AreaUnit.Undefined) + if (unit == AreaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -109,7 +109,7 @@ public Area(double value, AreaUnit unit) /// No unit was found for the given . public Area(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -295,7 +295,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(AreaUnit.SquareMeter, AreaUnit.SquareNauticalMile, quantity => new Area(quantity.Value/3429904, AreaUnit.SquareNauticalMile)); unitConverter.SetConversionFunction(AreaUnit.SquareMeter, AreaUnit.SquareYard, quantity => new Area(quantity.Value/0.836127, AreaUnit.SquareYard)); unitConverter.SetConversionFunction(AreaUnit.SquareMeter, AreaUnit.UsSurveySquareFoot, quantity => new Area(quantity.Value/0.09290341161, AreaUnit.UsSurveySquareFoot)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(AreaUnit.SquareMeter, AreaUnit.SquareMeter, quantity => quantity); @@ -758,8 +757,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out AreaU /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Area objArea)) throw new ArgumentException("Expected type Area.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Area objArea)) throw new ArgumentException("Expected type Area.", nameof(obj)); return CompareTo(objArea); } @@ -774,7 +773,7 @@ public int CompareTo(Area other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Area objArea)) + if (obj is null || !(obj is Area objArea)) return false; return Equals(objArea); @@ -829,7 +828,7 @@ public bool Equals(Area other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Area other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -857,7 +856,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(AreaUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -867,13 +866,13 @@ public double As(AreaUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -882,7 +881,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is AreaUnit unitAsAreaUnit)) + if (!(unit is AreaUnit unitAsAreaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaUnit)} is supported.", nameof(unit)); return As(unitAsAreaUnit); @@ -906,18 +905,18 @@ public Area ToUnit(AreaUnit unit) /// A Area with the specified unit. public Area ToUnit(AreaUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Area), Unit, typeof(Area), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Area), Unit, typeof(Area), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Area)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -932,7 +931,7 @@ public Area ToUnit(AreaUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is AreaUnit unitAsAreaUnit)) + if (!(unit is AreaUnit unitAsAreaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaUnit)} is supported.", nameof(unit)); return ToUnit(unitAsAreaUnit, DefaultConversionFunctions); @@ -941,7 +940,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is AreaUnit unitAsAreaUnit)) + if (!(unit is AreaUnit unitAsAreaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaUnit)} is supported.", nameof(unit)); return ToUnit(unitAsAreaUnit, unitConverter); @@ -950,13 +949,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Area ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1131,15 +1130,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Area)) + if (conversionType == typeof(Area)) return this; - else if(conversionType == typeof(AreaUnit)) + else if (conversionType == typeof(AreaUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Area.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Area.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Area.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Area)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs index 5f6b209e5b..85522c9ed4 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs @@ -79,7 +79,7 @@ static AreaDensity() /// If value is NaN or Infinity. public AreaDensity(double value, AreaDensityUnit unit) { - if(unit == AreaDensityUnit.Undefined) + if (unit == AreaDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -96,7 +96,7 @@ public AreaDensity(double value, AreaDensityUnit unit) /// No unit was found for the given . public AreaDensity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -204,7 +204,6 @@ public AreaDensity(double value, UnitSystem unitSystem) internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> AreaDensityUnit - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(AreaDensityUnit.KilogramPerSquareMeter, AreaDensityUnit.KilogramPerSquareMeter, quantity => quantity); @@ -497,8 +496,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out AreaD /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AreaDensity objAreaDensity)) throw new ArgumentException("Expected type AreaDensity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is AreaDensity objAreaDensity)) throw new ArgumentException("Expected type AreaDensity.", nameof(obj)); return CompareTo(objAreaDensity); } @@ -513,7 +512,7 @@ public int CompareTo(AreaDensity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is AreaDensity objAreaDensity)) + if (obj is null || !(obj is AreaDensity objAreaDensity)) return false; return Equals(objAreaDensity); @@ -568,7 +567,7 @@ public bool Equals(AreaDensity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(AreaDensity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -596,7 +595,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(AreaDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -606,13 +605,13 @@ public double As(AreaDensityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -621,7 +620,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is AreaDensityUnit unitAsAreaDensityUnit)) + if (!(unit is AreaDensityUnit unitAsAreaDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaDensityUnit)} is supported.", nameof(unit)); return As(unitAsAreaDensityUnit); @@ -645,18 +644,18 @@ public AreaDensity ToUnit(AreaDensityUnit unit) /// A AreaDensity with the specified unit. public AreaDensity ToUnit(AreaDensityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(AreaDensity), Unit, typeof(AreaDensity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(AreaDensity), Unit, typeof(AreaDensity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (AreaDensity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -671,7 +670,7 @@ public AreaDensity ToUnit(AreaDensityUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is AreaDensityUnit unitAsAreaDensityUnit)) + if (!(unit is AreaDensityUnit unitAsAreaDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaDensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsAreaDensityUnit, DefaultConversionFunctions); @@ -680,7 +679,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is AreaDensityUnit unitAsAreaDensityUnit)) + if (!(unit is AreaDensityUnit unitAsAreaDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaDensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsAreaDensityUnit, unitConverter); @@ -689,13 +688,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public AreaDensity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -870,15 +869,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(AreaDensity)) + if (conversionType == typeof(AreaDensity)) return this; - else if(conversionType == typeof(AreaDensityUnit)) + else if (conversionType == typeof(AreaDensityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return AreaDensity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return AreaDensity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return AreaDensity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(AreaDensity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs index e43f1c6f66..3f131e5c90 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -84,7 +84,7 @@ static AreaMomentOfInertia() /// If value is NaN or Infinity. public AreaMomentOfInertia(double value, AreaMomentOfInertiaUnit unit) { - if(unit == AreaMomentOfInertiaUnit.Undefined) + if (unit == AreaMomentOfInertiaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -101,7 +101,7 @@ public AreaMomentOfInertia(double value, AreaMomentOfInertiaUnit unit) /// No unit was found for the given . public AreaMomentOfInertia(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -239,7 +239,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(AreaMomentOfInertiaUnit.MeterToTheFourth, AreaMomentOfInertiaUnit.FootToTheFourth, quantity => new AreaMomentOfInertia(quantity.Value/Math.Pow(0.3048, 4), AreaMomentOfInertiaUnit.FootToTheFourth)); unitConverter.SetConversionFunction(AreaMomentOfInertiaUnit.MeterToTheFourth, AreaMomentOfInertiaUnit.InchToTheFourth, quantity => new AreaMomentOfInertia(quantity.Value/Math.Pow(2.54e-2, 4), AreaMomentOfInertiaUnit.InchToTheFourth)); unitConverter.SetConversionFunction(AreaMomentOfInertiaUnit.MeterToTheFourth, AreaMomentOfInertiaUnit.MillimeterToTheFourth, quantity => new AreaMomentOfInertia(quantity.Value*1e12, AreaMomentOfInertiaUnit.MillimeterToTheFourth)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(AreaMomentOfInertiaUnit.MeterToTheFourth, AreaMomentOfInertiaUnit.MeterToTheFourth, quantity => quantity); @@ -587,8 +586,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out AreaM /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AreaMomentOfInertia objAreaMomentOfInertia)) throw new ArgumentException("Expected type AreaMomentOfInertia.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is AreaMomentOfInertia objAreaMomentOfInertia)) throw new ArgumentException("Expected type AreaMomentOfInertia.", nameof(obj)); return CompareTo(objAreaMomentOfInertia); } @@ -603,7 +602,7 @@ public int CompareTo(AreaMomentOfInertia other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is AreaMomentOfInertia objAreaMomentOfInertia)) + if (obj is null || !(obj is AreaMomentOfInertia objAreaMomentOfInertia)) return false; return Equals(objAreaMomentOfInertia); @@ -658,7 +657,7 @@ public bool Equals(AreaMomentOfInertia other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(AreaMomentOfInertia other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -686,7 +685,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(AreaMomentOfInertiaUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -696,13 +695,13 @@ public double As(AreaMomentOfInertiaUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -711,7 +710,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is AreaMomentOfInertiaUnit unitAsAreaMomentOfInertiaUnit)) + if (!(unit is AreaMomentOfInertiaUnit unitAsAreaMomentOfInertiaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaMomentOfInertiaUnit)} is supported.", nameof(unit)); return As(unitAsAreaMomentOfInertiaUnit); @@ -735,18 +734,18 @@ public AreaMomentOfInertia ToUnit(AreaMomentOfInertiaUnit unit) /// A AreaMomentOfInertia with the specified unit. public AreaMomentOfInertia ToUnit(AreaMomentOfInertiaUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(AreaMomentOfInertia), Unit, typeof(AreaMomentOfInertia), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(AreaMomentOfInertia), Unit, typeof(AreaMomentOfInertia), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (AreaMomentOfInertia)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -761,7 +760,7 @@ public AreaMomentOfInertia ToUnit(AreaMomentOfInertiaUnit unit, UnitConverter un /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is AreaMomentOfInertiaUnit unitAsAreaMomentOfInertiaUnit)) + if (!(unit is AreaMomentOfInertiaUnit unitAsAreaMomentOfInertiaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaMomentOfInertiaUnit)} is supported.", nameof(unit)); return ToUnit(unitAsAreaMomentOfInertiaUnit, DefaultConversionFunctions); @@ -770,7 +769,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is AreaMomentOfInertiaUnit unitAsAreaMomentOfInertiaUnit)) + if (!(unit is AreaMomentOfInertiaUnit unitAsAreaMomentOfInertiaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaMomentOfInertiaUnit)} is supported.", nameof(unit)); return ToUnit(unitAsAreaMomentOfInertiaUnit, unitConverter); @@ -779,13 +778,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public AreaMomentOfInertia ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -960,15 +959,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(AreaMomentOfInertia)) + if (conversionType == typeof(AreaMomentOfInertia)) return this; - else if(conversionType == typeof(AreaMomentOfInertiaUnit)) + else if (conversionType == typeof(AreaMomentOfInertiaUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return AreaMomentOfInertia.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return AreaMomentOfInertia.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return AreaMomentOfInertia.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs index 9b559e2190..3c1b09aca0 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs @@ -107,7 +107,7 @@ static BitRate() /// If value is NaN or Infinity. public BitRate(decimal value, BitRateUnit unit) { - if(unit == BitRateUnit.Undefined) + if (unit == BitRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = value; @@ -124,7 +124,7 @@ public BitRate(decimal value, BitRateUnit unit) /// No unit was found for the given . public BitRate(decimal value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -387,7 +387,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(BitRateUnit.BitPerSecond, BitRateUnit.TebibytePerSecond, quantity => new BitRate((quantity.Value/8m) / (1024m * 1024 * 1024 * 1024), BitRateUnit.TebibytePerSecond)); unitConverter.SetConversionFunction(BitRateUnit.BitPerSecond, BitRateUnit.TerabitPerSecond, quantity => new BitRate((quantity.Value) / 1e12m, BitRateUnit.TerabitPerSecond)); unitConverter.SetConversionFunction(BitRateUnit.BitPerSecond, BitRateUnit.TerabytePerSecond, quantity => new BitRate((quantity.Value/8m) / 1e12m, BitRateUnit.TerabytePerSecond)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(BitRateUnit.BitPerSecond, BitRateUnit.BitPerSecond, quantity => quantity); @@ -955,8 +954,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out BitRa /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is BitRate objBitRate)) throw new ArgumentException("Expected type BitRate.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is BitRate objBitRate)) throw new ArgumentException("Expected type BitRate.", nameof(obj)); return CompareTo(objBitRate); } @@ -971,7 +970,7 @@ public int CompareTo(BitRate other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is BitRate objBitRate)) + if (obj is null || !(obj is BitRate objBitRate)) return false; return Equals(objBitRate); @@ -1026,7 +1025,7 @@ public bool Equals(BitRate other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(BitRate other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1054,7 +1053,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(BitRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1064,13 +1063,13 @@ public double As(BitRateUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1079,7 +1078,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is BitRateUnit unitAsBitRateUnit)) + if (!(unit is BitRateUnit unitAsBitRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(BitRateUnit)} is supported.", nameof(unit)); return As(unitAsBitRateUnit); @@ -1103,18 +1102,18 @@ public BitRate ToUnit(BitRateUnit unit) /// A BitRate with the specified unit. public BitRate ToUnit(BitRateUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(BitRate), Unit, typeof(BitRate), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(BitRate), Unit, typeof(BitRate), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (BitRate)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1129,7 +1128,7 @@ public BitRate ToUnit(BitRateUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is BitRateUnit unitAsBitRateUnit)) + if (!(unit is BitRateUnit unitAsBitRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(BitRateUnit)} is supported.", nameof(unit)); return ToUnit(unitAsBitRateUnit, DefaultConversionFunctions); @@ -1138,7 +1137,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is BitRateUnit unitAsBitRateUnit)) + if (!(unit is BitRateUnit unitAsBitRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(BitRateUnit)} is supported.", nameof(unit)); return ToUnit(unitAsBitRateUnit, unitConverter); @@ -1147,13 +1146,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public BitRate ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1328,15 +1327,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(BitRate)) + if (conversionType == typeof(BitRate)) return this; - else if(conversionType == typeof(BitRateUnit)) + else if (conversionType == typeof(BitRateUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return BitRate.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return BitRate.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return BitRate.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(BitRate)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs index 749fdf161e..adab9fe5cc 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -81,7 +81,7 @@ static BrakeSpecificFuelConsumption() /// If value is NaN or Infinity. public BrakeSpecificFuelConsumption(double value, BrakeSpecificFuelConsumptionUnit unit) { - if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) + if (unit == BrakeSpecificFuelConsumptionUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -98,7 +98,7 @@ public BrakeSpecificFuelConsumption(double value, BrakeSpecificFuelConsumptionUn /// No unit was found for the given . public BrakeSpecificFuelConsumption(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -218,7 +218,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) // Register in unit converter: BaseUnit -> BrakeSpecificFuelConsumptionUnit unitConverter.SetConversionFunction(BrakeSpecificFuelConsumptionUnit.KilogramPerJoule, BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour, quantity => new BrakeSpecificFuelConsumption(quantity.Value*3.6e9, BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour)); unitConverter.SetConversionFunction(BrakeSpecificFuelConsumptionUnit.KilogramPerJoule, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour, quantity => new BrakeSpecificFuelConsumption(quantity.Value/1.689659410672e-7, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(BrakeSpecificFuelConsumptionUnit.KilogramPerJoule, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule, quantity => quantity); @@ -533,8 +532,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Brake /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is BrakeSpecificFuelConsumption objBrakeSpecificFuelConsumption)) throw new ArgumentException("Expected type BrakeSpecificFuelConsumption.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is BrakeSpecificFuelConsumption objBrakeSpecificFuelConsumption)) throw new ArgumentException("Expected type BrakeSpecificFuelConsumption.", nameof(obj)); return CompareTo(objBrakeSpecificFuelConsumption); } @@ -549,7 +548,7 @@ public int CompareTo(BrakeSpecificFuelConsumption other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is BrakeSpecificFuelConsumption objBrakeSpecificFuelConsumption)) + if (obj is null || !(obj is BrakeSpecificFuelConsumption objBrakeSpecificFuelConsumption)) return false; return Equals(objBrakeSpecificFuelConsumption); @@ -604,7 +603,7 @@ public bool Equals(BrakeSpecificFuelConsumption other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(BrakeSpecificFuelConsumption other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -632,7 +631,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(BrakeSpecificFuelConsumptionUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -642,13 +641,13 @@ public double As(BrakeSpecificFuelConsumptionUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -657,7 +656,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is BrakeSpecificFuelConsumptionUnit unitAsBrakeSpecificFuelConsumptionUnit)) + if (!(unit is BrakeSpecificFuelConsumptionUnit unitAsBrakeSpecificFuelConsumptionUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(BrakeSpecificFuelConsumptionUnit)} is supported.", nameof(unit)); return As(unitAsBrakeSpecificFuelConsumptionUnit); @@ -681,18 +680,18 @@ public BrakeSpecificFuelConsumption ToUnit(BrakeSpecificFuelConsumptionUnit unit /// A BrakeSpecificFuelConsumption with the specified unit. public BrakeSpecificFuelConsumption ToUnit(BrakeSpecificFuelConsumptionUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(BrakeSpecificFuelConsumption), Unit, typeof(BrakeSpecificFuelConsumption), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(BrakeSpecificFuelConsumption), Unit, typeof(BrakeSpecificFuelConsumption), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (BrakeSpecificFuelConsumption)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -707,7 +706,7 @@ public BrakeSpecificFuelConsumption ToUnit(BrakeSpecificFuelConsumptionUnit unit /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is BrakeSpecificFuelConsumptionUnit unitAsBrakeSpecificFuelConsumptionUnit)) + if (!(unit is BrakeSpecificFuelConsumptionUnit unitAsBrakeSpecificFuelConsumptionUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(BrakeSpecificFuelConsumptionUnit)} is supported.", nameof(unit)); return ToUnit(unitAsBrakeSpecificFuelConsumptionUnit, DefaultConversionFunctions); @@ -716,7 +715,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is BrakeSpecificFuelConsumptionUnit unitAsBrakeSpecificFuelConsumptionUnit)) + if (!(unit is BrakeSpecificFuelConsumptionUnit unitAsBrakeSpecificFuelConsumptionUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(BrakeSpecificFuelConsumptionUnit)} is supported.", nameof(unit)); return ToUnit(unitAsBrakeSpecificFuelConsumptionUnit, unitConverter); @@ -725,13 +724,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public BrakeSpecificFuelConsumption ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -906,15 +905,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(BrakeSpecificFuelConsumption)) + if (conversionType == typeof(BrakeSpecificFuelConsumption)) return this; - else if(conversionType == typeof(BrakeSpecificFuelConsumptionUnit)) + else if (conversionType == typeof(BrakeSpecificFuelConsumptionUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return BrakeSpecificFuelConsumption.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return BrakeSpecificFuelConsumption.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return BrakeSpecificFuelConsumption.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs index 741851fe96..201e33b16a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs @@ -88,7 +88,7 @@ static Capacitance() /// If value is NaN or Infinity. public Capacitance(double value, CapacitanceUnit unit) { - if(unit == CapacitanceUnit.Undefined) + if (unit == CapacitanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -105,7 +105,7 @@ public Capacitance(double value, CapacitanceUnit unit) /// No unit was found for the given . public Capacitance(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -249,7 +249,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(CapacitanceUnit.Farad, CapacitanceUnit.Millifarad, quantity => new Capacitance((quantity.Value) / 1e-3d, CapacitanceUnit.Millifarad)); unitConverter.SetConversionFunction(CapacitanceUnit.Farad, CapacitanceUnit.Nanofarad, quantity => new Capacitance((quantity.Value) / 1e-9d, CapacitanceUnit.Nanofarad)); unitConverter.SetConversionFunction(CapacitanceUnit.Farad, CapacitanceUnit.Picofarad, quantity => new Capacitance((quantity.Value) / 1e-12d, CapacitanceUnit.Picofarad)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(CapacitanceUnit.Farad, CapacitanceUnit.Farad, quantity => quantity); @@ -608,8 +607,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Capac /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Capacitance objCapacitance)) throw new ArgumentException("Expected type Capacitance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Capacitance objCapacitance)) throw new ArgumentException("Expected type Capacitance.", nameof(obj)); return CompareTo(objCapacitance); } @@ -624,7 +623,7 @@ public int CompareTo(Capacitance other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Capacitance objCapacitance)) + if (obj is null || !(obj is Capacitance objCapacitance)) return false; return Equals(objCapacitance); @@ -679,7 +678,7 @@ public bool Equals(Capacitance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Capacitance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -707,7 +706,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(CapacitanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -717,13 +716,13 @@ public double As(CapacitanceUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -732,7 +731,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is CapacitanceUnit unitAsCapacitanceUnit)) + if (!(unit is CapacitanceUnit unitAsCapacitanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(CapacitanceUnit)} is supported.", nameof(unit)); return As(unitAsCapacitanceUnit); @@ -756,18 +755,18 @@ public Capacitance ToUnit(CapacitanceUnit unit) /// A Capacitance with the specified unit. public Capacitance ToUnit(CapacitanceUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Capacitance), Unit, typeof(Capacitance), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Capacitance), Unit, typeof(Capacitance), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Capacitance)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -782,7 +781,7 @@ public Capacitance ToUnit(CapacitanceUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is CapacitanceUnit unitAsCapacitanceUnit)) + if (!(unit is CapacitanceUnit unitAsCapacitanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(CapacitanceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsCapacitanceUnit, DefaultConversionFunctions); @@ -791,7 +790,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is CapacitanceUnit unitAsCapacitanceUnit)) + if (!(unit is CapacitanceUnit unitAsCapacitanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(CapacitanceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsCapacitanceUnit, unitConverter); @@ -800,13 +799,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Capacitance ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -981,15 +980,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Capacitance)) + if (conversionType == typeof(Capacitance)) return this; - else if(conversionType == typeof(CapacitanceUnit)) + else if (conversionType == typeof(CapacitanceUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Capacitance.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Capacitance.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Capacitance.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Capacitance)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs index 413fa7e334..510dcb1a09 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs @@ -81,7 +81,7 @@ static CoefficientOfThermalExpansion() /// If value is NaN or Infinity. public CoefficientOfThermalExpansion(double value, CoefficientOfThermalExpansionUnit unit) { - if(unit == CoefficientOfThermalExpansionUnit.Undefined) + if (unit == CoefficientOfThermalExpansionUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -98,7 +98,7 @@ public CoefficientOfThermalExpansion(double value, CoefficientOfThermalExpansion /// No unit was found for the given . public CoefficientOfThermalExpansion(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -218,7 +218,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) // Register in unit converter: BaseUnit -> CoefficientOfThermalExpansionUnit unitConverter.SetConversionFunction(CoefficientOfThermalExpansionUnit.InverseKelvin, CoefficientOfThermalExpansionUnit.InverseDegreeCelsius, quantity => new CoefficientOfThermalExpansion(quantity.Value, CoefficientOfThermalExpansionUnit.InverseDegreeCelsius)); unitConverter.SetConversionFunction(CoefficientOfThermalExpansionUnit.InverseKelvin, CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit, quantity => new CoefficientOfThermalExpansion(quantity.Value*5/9, CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(CoefficientOfThermalExpansionUnit.InverseKelvin, CoefficientOfThermalExpansionUnit.InverseKelvin, quantity => quantity); @@ -533,8 +532,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Coeff /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) throw new ArgumentException("Expected type CoefficientOfThermalExpansion.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) throw new ArgumentException("Expected type CoefficientOfThermalExpansion.", nameof(obj)); return CompareTo(objCoefficientOfThermalExpansion); } @@ -549,7 +548,7 @@ public int CompareTo(CoefficientOfThermalExpansion other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) + if (obj is null || !(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) return false; return Equals(objCoefficientOfThermalExpansion); @@ -604,7 +603,7 @@ public bool Equals(CoefficientOfThermalExpansion other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(CoefficientOfThermalExpansion other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -632,7 +631,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(CoefficientOfThermalExpansionUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -642,13 +641,13 @@ public double As(CoefficientOfThermalExpansionUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -657,7 +656,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is CoefficientOfThermalExpansionUnit unitAsCoefficientOfThermalExpansionUnit)) + if (!(unit is CoefficientOfThermalExpansionUnit unitAsCoefficientOfThermalExpansionUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(CoefficientOfThermalExpansionUnit)} is supported.", nameof(unit)); return As(unitAsCoefficientOfThermalExpansionUnit); @@ -681,18 +680,18 @@ public CoefficientOfThermalExpansion ToUnit(CoefficientOfThermalExpansionUnit un /// A CoefficientOfThermalExpansion with the specified unit. public CoefficientOfThermalExpansion ToUnit(CoefficientOfThermalExpansionUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(CoefficientOfThermalExpansion), Unit, typeof(CoefficientOfThermalExpansion), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(CoefficientOfThermalExpansion), Unit, typeof(CoefficientOfThermalExpansion), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (CoefficientOfThermalExpansion)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -707,7 +706,7 @@ public CoefficientOfThermalExpansion ToUnit(CoefficientOfThermalExpansionUnit un /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is CoefficientOfThermalExpansionUnit unitAsCoefficientOfThermalExpansionUnit)) + if (!(unit is CoefficientOfThermalExpansionUnit unitAsCoefficientOfThermalExpansionUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(CoefficientOfThermalExpansionUnit)} is supported.", nameof(unit)); return ToUnit(unitAsCoefficientOfThermalExpansionUnit, DefaultConversionFunctions); @@ -716,7 +715,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is CoefficientOfThermalExpansionUnit unitAsCoefficientOfThermalExpansionUnit)) + if (!(unit is CoefficientOfThermalExpansionUnit unitAsCoefficientOfThermalExpansionUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(CoefficientOfThermalExpansionUnit)} is supported.", nameof(unit)); return ToUnit(unitAsCoefficientOfThermalExpansionUnit, unitConverter); @@ -725,13 +724,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public CoefficientOfThermalExpansion ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -906,15 +905,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(CoefficientOfThermalExpansion)) + if (conversionType == typeof(CoefficientOfThermalExpansion)) return this; - else if(conversionType == typeof(CoefficientOfThermalExpansionUnit)) + else if (conversionType == typeof(CoefficientOfThermalExpansionUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return CoefficientOfThermalExpansion.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return CoefficientOfThermalExpansion.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return CoefficientOfThermalExpansion.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs index 1c89932d7c..b48efc80ce 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -132,7 +132,7 @@ static Density() /// If value is NaN or Infinity. public Density(double value, DensityUnit unit) { - if(unit == DensityUnit.Undefined) + if (unit == DensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -149,7 +149,7 @@ public Density(double value, DensityUnit unit) /// No unit was found for the given . public Density(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -557,7 +557,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.TonnePerCubicInch, quantity => new Density(quantity.Value/6.10237440947323e7, DensityUnit.TonnePerCubicInch)); unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.TonnePerCubicMeter, quantity => new Density(quantity.Value*0.001, DensityUnit.TonnePerCubicMeter)); unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.TonnePerCubicMillimeter, quantity => new Density(quantity.Value*1e-12, DensityUnit.TonnePerCubicMillimeter)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(DensityUnit.KilogramPerCubicMeter, DensityUnit.KilogramPerCubicMeter, quantity => quantity); @@ -1404,8 +1403,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Densi /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Density objDensity)) throw new ArgumentException("Expected type Density.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Density objDensity)) throw new ArgumentException("Expected type Density.", nameof(obj)); return CompareTo(objDensity); } @@ -1420,7 +1419,7 @@ public int CompareTo(Density other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Density objDensity)) + if (obj is null || !(obj is Density objDensity)) return false; return Equals(objDensity); @@ -1475,7 +1474,7 @@ public bool Equals(Density other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Density other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1503,7 +1502,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(DensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1513,13 +1512,13 @@ public double As(DensityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1528,7 +1527,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is DensityUnit unitAsDensityUnit)) + if (!(unit is DensityUnit unitAsDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DensityUnit)} is supported.", nameof(unit)); return As(unitAsDensityUnit); @@ -1552,18 +1551,18 @@ public Density ToUnit(DensityUnit unit) /// A Density with the specified unit. public Density ToUnit(DensityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Density), Unit, typeof(Density), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Density), Unit, typeof(Density), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Density)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1578,7 +1577,7 @@ public Density ToUnit(DensityUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is DensityUnit unitAsDensityUnit)) + if (!(unit is DensityUnit unitAsDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsDensityUnit, DefaultConversionFunctions); @@ -1587,7 +1586,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is DensityUnit unitAsDensityUnit)) + if (!(unit is DensityUnit unitAsDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsDensityUnit, unitConverter); @@ -1596,13 +1595,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Density ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1777,15 +1776,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Density)) + if (conversionType == typeof(Density)) return this; - else if(conversionType == typeof(DensityUnit)) + else if (conversionType == typeof(DensityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Density.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Density.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Density.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Density)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs index 07aa8ecc5c..3ed8de270b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs @@ -89,7 +89,7 @@ static Duration() /// If value is NaN or Infinity. public Duration(double value, DurationUnit unit) { - if(unit == DurationUnit.Undefined) + if (unit == DurationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -106,7 +106,7 @@ public Duration(double value, DurationUnit unit) /// No unit was found for the given . public Duration(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -274,7 +274,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(DurationUnit.Second, DurationUnit.Nanosecond, quantity => new Duration((quantity.Value) / 1e-9d, DurationUnit.Nanosecond)); unitConverter.SetConversionFunction(DurationUnit.Second, DurationUnit.Week, quantity => new Duration(quantity.Value/(7*24*3600), DurationUnit.Week)); unitConverter.SetConversionFunction(DurationUnit.Second, DurationUnit.Year365, quantity => new Duration(quantity.Value/(365*24*3600), DurationUnit.Year365)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(DurationUnit.Second, DurationUnit.Second, quantity => quantity); @@ -687,8 +686,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Durat /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Duration objDuration)) throw new ArgumentException("Expected type Duration.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Duration objDuration)) throw new ArgumentException("Expected type Duration.", nameof(obj)); return CompareTo(objDuration); } @@ -703,7 +702,7 @@ public int CompareTo(Duration other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Duration objDuration)) + if (obj is null || !(obj is Duration objDuration)) return false; return Equals(objDuration); @@ -758,7 +757,7 @@ public bool Equals(Duration other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Duration other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -786,7 +785,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(DurationUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -796,13 +795,13 @@ public double As(DurationUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -811,7 +810,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is DurationUnit unitAsDurationUnit)) + if (!(unit is DurationUnit unitAsDurationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DurationUnit)} is supported.", nameof(unit)); return As(unitAsDurationUnit); @@ -835,18 +834,18 @@ public Duration ToUnit(DurationUnit unit) /// A Duration with the specified unit. public Duration ToUnit(DurationUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Duration), Unit, typeof(Duration), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Duration), Unit, typeof(Duration), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Duration)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -861,7 +860,7 @@ public Duration ToUnit(DurationUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is DurationUnit unitAsDurationUnit)) + if (!(unit is DurationUnit unitAsDurationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DurationUnit)} is supported.", nameof(unit)); return ToUnit(unitAsDurationUnit, DefaultConversionFunctions); @@ -870,7 +869,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is DurationUnit unitAsDurationUnit)) + if (!(unit is DurationUnit unitAsDurationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DurationUnit)} is supported.", nameof(unit)); return ToUnit(unitAsDurationUnit, unitConverter); @@ -879,13 +878,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Duration ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1060,15 +1059,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Duration)) + if (conversionType == typeof(Duration)) return this; - else if(conversionType == typeof(DurationUnit)) + else if (conversionType == typeof(DurationUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Duration.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Duration.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Duration.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Duration)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs index 8f59ee5a59..8016ca273a 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -91,7 +91,7 @@ static DynamicViscosity() /// If value is NaN or Infinity. public DynamicViscosity(double value, DynamicViscosityUnit unit) { - if(unit == DynamicViscosityUnit.Undefined) + if (unit == DynamicViscosityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -108,7 +108,7 @@ public DynamicViscosity(double value, DynamicViscosityUnit unit) /// No unit was found for the given . public DynamicViscosity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -270,7 +270,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(DynamicViscosityUnit.NewtonSecondPerMeterSquared, DynamicViscosityUnit.PoundForceSecondPerSquareInch, quantity => new DynamicViscosity(quantity.Value / 6.8947572931683613e3, DynamicViscosityUnit.PoundForceSecondPerSquareInch)); unitConverter.SetConversionFunction(DynamicViscosityUnit.NewtonSecondPerMeterSquared, DynamicViscosityUnit.PoundPerFootSecond, quantity => new DynamicViscosity(quantity.Value / 1.4881639, DynamicViscosityUnit.PoundPerFootSecond)); unitConverter.SetConversionFunction(DynamicViscosityUnit.NewtonSecondPerMeterSquared, DynamicViscosityUnit.Reyn, quantity => new DynamicViscosity(quantity.Value / 6.8947572931683613e3, DynamicViscosityUnit.Reyn)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(DynamicViscosityUnit.NewtonSecondPerMeterSquared, DynamicViscosityUnit.NewtonSecondPerMeterSquared, quantity => quantity); @@ -662,8 +661,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Dynam /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is DynamicViscosity objDynamicViscosity)) throw new ArgumentException("Expected type DynamicViscosity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is DynamicViscosity objDynamicViscosity)) throw new ArgumentException("Expected type DynamicViscosity.", nameof(obj)); return CompareTo(objDynamicViscosity); } @@ -678,7 +677,7 @@ public int CompareTo(DynamicViscosity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is DynamicViscosity objDynamicViscosity)) + if (obj is null || !(obj is DynamicViscosity objDynamicViscosity)) return false; return Equals(objDynamicViscosity); @@ -733,7 +732,7 @@ public bool Equals(DynamicViscosity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(DynamicViscosity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -761,7 +760,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(DynamicViscosityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -771,13 +770,13 @@ public double As(DynamicViscosityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -786,7 +785,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is DynamicViscosityUnit unitAsDynamicViscosityUnit)) + if (!(unit is DynamicViscosityUnit unitAsDynamicViscosityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DynamicViscosityUnit)} is supported.", nameof(unit)); return As(unitAsDynamicViscosityUnit); @@ -810,18 +809,18 @@ public DynamicViscosity ToUnit(DynamicViscosityUnit unit) /// A DynamicViscosity with the specified unit. public DynamicViscosity ToUnit(DynamicViscosityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(DynamicViscosity), Unit, typeof(DynamicViscosity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(DynamicViscosity), Unit, typeof(DynamicViscosity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (DynamicViscosity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -836,7 +835,7 @@ public DynamicViscosity ToUnit(DynamicViscosityUnit unit, UnitConverter unitConv /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is DynamicViscosityUnit unitAsDynamicViscosityUnit)) + if (!(unit is DynamicViscosityUnit unitAsDynamicViscosityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DynamicViscosityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsDynamicViscosityUnit, DefaultConversionFunctions); @@ -845,7 +844,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is DynamicViscosityUnit unitAsDynamicViscosityUnit)) + if (!(unit is DynamicViscosityUnit unitAsDynamicViscosityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DynamicViscosityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsDynamicViscosityUnit, unitConverter); @@ -854,13 +853,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public DynamicViscosity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1035,15 +1034,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(DynamicViscosity)) + if (conversionType == typeof(DynamicViscosity)) return this; - else if(conversionType == typeof(DynamicViscosityUnit)) + else if (conversionType == typeof(DynamicViscosityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return DynamicViscosity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return DynamicViscosity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return DynamicViscosity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs index 3af7a9183e..1282e56ef4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs @@ -82,7 +82,7 @@ static ElectricAdmittance() /// If value is NaN or Infinity. public ElectricAdmittance(double value, ElectricAdmittanceUnit unit) { - if(unit == ElectricAdmittanceUnit.Undefined) + if (unit == ElectricAdmittanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public ElectricAdmittance(double value, ElectricAdmittanceUnit unit) /// No unit was found for the given . public ElectricAdmittance(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -225,7 +225,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ElectricAdmittanceUnit.Siemens, ElectricAdmittanceUnit.Microsiemens, quantity => new ElectricAdmittance((quantity.Value) / 1e-6d, ElectricAdmittanceUnit.Microsiemens)); unitConverter.SetConversionFunction(ElectricAdmittanceUnit.Siemens, ElectricAdmittanceUnit.Millisiemens, quantity => new ElectricAdmittance((quantity.Value) / 1e-3d, ElectricAdmittanceUnit.Millisiemens)); unitConverter.SetConversionFunction(ElectricAdmittanceUnit.Siemens, ElectricAdmittanceUnit.Nanosiemens, quantity => new ElectricAdmittance((quantity.Value) / 1e-9d, ElectricAdmittanceUnit.Nanosiemens)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricAdmittanceUnit.Siemens, ElectricAdmittanceUnit.Siemens, quantity => quantity); @@ -551,8 +550,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricAdmittance objElectricAdmittance)) throw new ArgumentException("Expected type ElectricAdmittance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricAdmittance objElectricAdmittance)) throw new ArgumentException("Expected type ElectricAdmittance.", nameof(obj)); return CompareTo(objElectricAdmittance); } @@ -567,7 +566,7 @@ public int CompareTo(ElectricAdmittance other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricAdmittance objElectricAdmittance)) + if (obj is null || !(obj is ElectricAdmittance objElectricAdmittance)) return false; return Equals(objElectricAdmittance); @@ -622,7 +621,7 @@ public bool Equals(ElectricAdmittance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricAdmittance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -650,7 +649,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricAdmittanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -660,13 +659,13 @@ public double As(ElectricAdmittanceUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -675,7 +674,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricAdmittanceUnit unitAsElectricAdmittanceUnit)) + if (!(unit is ElectricAdmittanceUnit unitAsElectricAdmittanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricAdmittanceUnit)} is supported.", nameof(unit)); return As(unitAsElectricAdmittanceUnit); @@ -699,18 +698,18 @@ public ElectricAdmittance ToUnit(ElectricAdmittanceUnit unit) /// A ElectricAdmittance with the specified unit. public ElectricAdmittance ToUnit(ElectricAdmittanceUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricAdmittance), Unit, typeof(ElectricAdmittance), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricAdmittance), Unit, typeof(ElectricAdmittance), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricAdmittance)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -725,7 +724,7 @@ public ElectricAdmittance ToUnit(ElectricAdmittanceUnit unit, UnitConverter unit /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricAdmittanceUnit unitAsElectricAdmittanceUnit)) + if (!(unit is ElectricAdmittanceUnit unitAsElectricAdmittanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricAdmittanceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricAdmittanceUnit, DefaultConversionFunctions); @@ -734,7 +733,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricAdmittanceUnit unitAsElectricAdmittanceUnit)) + if (!(unit is ElectricAdmittanceUnit unitAsElectricAdmittanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricAdmittanceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricAdmittanceUnit, unitConverter); @@ -743,13 +742,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricAdmittance ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -924,15 +923,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricAdmittance)) + if (conversionType == typeof(ElectricAdmittance)) return this; - else if(conversionType == typeof(ElectricAdmittanceUnit)) + else if (conversionType == typeof(ElectricAdmittanceUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricAdmittance.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricAdmittance.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricAdmittance.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs index 09b446d616..b0389f6ebb 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -86,7 +86,7 @@ static ElectricCharge() /// If value is NaN or Infinity. public ElectricCharge(double value, ElectricChargeUnit unit) { - if(unit == ElectricChargeUnit.Undefined) + if (unit == ElectricChargeUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -103,7 +103,7 @@ public ElectricCharge(double value, ElectricChargeUnit unit) /// No unit was found for the given . public ElectricCharge(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -235,7 +235,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ElectricChargeUnit.Coulomb, ElectricChargeUnit.KiloampereHour, quantity => new ElectricCharge((quantity.Value*2.77777777777e-4) / 1e3d, ElectricChargeUnit.KiloampereHour)); unitConverter.SetConversionFunction(ElectricChargeUnit.Coulomb, ElectricChargeUnit.MegaampereHour, quantity => new ElectricCharge((quantity.Value*2.77777777777e-4) / 1e6d, ElectricChargeUnit.MegaampereHour)); unitConverter.SetConversionFunction(ElectricChargeUnit.Coulomb, ElectricChargeUnit.MilliampereHour, quantity => new ElectricCharge((quantity.Value*2.77777777777e-4) / 1e-3d, ElectricChargeUnit.MilliampereHour)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricChargeUnit.Coulomb, ElectricChargeUnit.Coulomb, quantity => quantity); @@ -572,8 +571,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCharge objElectricCharge)) throw new ArgumentException("Expected type ElectricCharge.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricCharge objElectricCharge)) throw new ArgumentException("Expected type ElectricCharge.", nameof(obj)); return CompareTo(objElectricCharge); } @@ -588,7 +587,7 @@ public int CompareTo(ElectricCharge other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricCharge objElectricCharge)) + if (obj is null || !(obj is ElectricCharge objElectricCharge)) return false; return Equals(objElectricCharge); @@ -643,7 +642,7 @@ public bool Equals(ElectricCharge other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricCharge other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -671,7 +670,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricChargeUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -681,13 +680,13 @@ public double As(ElectricChargeUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -696,7 +695,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricChargeUnit unitAsElectricChargeUnit)) + if (!(unit is ElectricChargeUnit unitAsElectricChargeUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricChargeUnit)} is supported.", nameof(unit)); return As(unitAsElectricChargeUnit); @@ -720,18 +719,18 @@ public ElectricCharge ToUnit(ElectricChargeUnit unit) /// A ElectricCharge with the specified unit. public ElectricCharge ToUnit(ElectricChargeUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricCharge), Unit, typeof(ElectricCharge), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricCharge), Unit, typeof(ElectricCharge), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricCharge)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -746,7 +745,7 @@ public ElectricCharge ToUnit(ElectricChargeUnit unit, UnitConverter unitConverte /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricChargeUnit unitAsElectricChargeUnit)) + if (!(unit is ElectricChargeUnit unitAsElectricChargeUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricChargeUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricChargeUnit, DefaultConversionFunctions); @@ -755,7 +754,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricChargeUnit unitAsElectricChargeUnit)) + if (!(unit is ElectricChargeUnit unitAsElectricChargeUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricChargeUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricChargeUnit, unitConverter); @@ -764,13 +763,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricCharge ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -945,15 +944,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricCharge)) + if (conversionType == typeof(ElectricCharge)) return this; - else if(conversionType == typeof(ElectricChargeUnit)) + else if (conversionType == typeof(ElectricChargeUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricCharge.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricCharge.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricCharge.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs index df7cded623..c1a8d2f402 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs @@ -82,7 +82,7 @@ static ElectricChargeDensity() /// If value is NaN or Infinity. public ElectricChargeDensity(double value, ElectricChargeDensityUnit unit) { - if(unit == ElectricChargeDensityUnit.Undefined) + if (unit == ElectricChargeDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public ElectricChargeDensity(double value, ElectricChargeDensityUnit unit) /// No unit was found for the given . public ElectricChargeDensity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -207,7 +207,6 @@ public ElectricChargeDensity(double value, UnitSystem unitSystem) internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> ElectricChargeDensityUnit - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricChargeDensityUnit.CoulombPerCubicMeter, ElectricChargeDensityUnit.CoulombPerCubicMeter, quantity => quantity); @@ -500,8 +499,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricChargeDensity objElectricChargeDensity)) throw new ArgumentException("Expected type ElectricChargeDensity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricChargeDensity objElectricChargeDensity)) throw new ArgumentException("Expected type ElectricChargeDensity.", nameof(obj)); return CompareTo(objElectricChargeDensity); } @@ -516,7 +515,7 @@ public int CompareTo(ElectricChargeDensity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricChargeDensity objElectricChargeDensity)) + if (obj is null || !(obj is ElectricChargeDensity objElectricChargeDensity)) return false; return Equals(objElectricChargeDensity); @@ -571,7 +570,7 @@ public bool Equals(ElectricChargeDensity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricChargeDensity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -599,7 +598,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricChargeDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -609,13 +608,13 @@ public double As(ElectricChargeDensityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -624,7 +623,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricChargeDensityUnit unitAsElectricChargeDensityUnit)) + if (!(unit is ElectricChargeDensityUnit unitAsElectricChargeDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricChargeDensityUnit)} is supported.", nameof(unit)); return As(unitAsElectricChargeDensityUnit); @@ -648,18 +647,18 @@ public ElectricChargeDensity ToUnit(ElectricChargeDensityUnit unit) /// A ElectricChargeDensity with the specified unit. public ElectricChargeDensity ToUnit(ElectricChargeDensityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricChargeDensity), Unit, typeof(ElectricChargeDensity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricChargeDensity), Unit, typeof(ElectricChargeDensity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricChargeDensity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -674,7 +673,7 @@ public ElectricChargeDensity ToUnit(ElectricChargeDensityUnit unit, UnitConverte /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricChargeDensityUnit unitAsElectricChargeDensityUnit)) + if (!(unit is ElectricChargeDensityUnit unitAsElectricChargeDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricChargeDensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricChargeDensityUnit, DefaultConversionFunctions); @@ -683,7 +682,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricChargeDensityUnit unitAsElectricChargeDensityUnit)) + if (!(unit is ElectricChargeDensityUnit unitAsElectricChargeDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricChargeDensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricChargeDensityUnit, unitConverter); @@ -692,13 +691,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricChargeDensity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -873,15 +872,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricChargeDensity)) + if (conversionType == typeof(ElectricChargeDensity)) return this; - else if(conversionType == typeof(ElectricChargeDensityUnit)) + else if (conversionType == typeof(ElectricChargeDensityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricChargeDensity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricChargeDensity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricChargeDensity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs index a6cf7df31d..a6942257ff 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs @@ -84,7 +84,7 @@ static ElectricConductance() /// If value is NaN or Infinity. public ElectricConductance(double value, ElectricConductanceUnit unit) { - if(unit == ElectricConductanceUnit.Undefined) + if (unit == ElectricConductanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -101,7 +101,7 @@ public ElectricConductance(double value, ElectricConductanceUnit unit) /// No unit was found for the given . public ElectricConductance(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -221,7 +221,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) // Register in unit converter: BaseUnit -> ElectricConductanceUnit unitConverter.SetConversionFunction(ElectricConductanceUnit.Siemens, ElectricConductanceUnit.Microsiemens, quantity => new ElectricConductance((quantity.Value) / 1e-6d, ElectricConductanceUnit.Microsiemens)); unitConverter.SetConversionFunction(ElectricConductanceUnit.Siemens, ElectricConductanceUnit.Millisiemens, quantity => new ElectricConductance((quantity.Value) / 1e-3d, ElectricConductanceUnit.Millisiemens)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricConductanceUnit.Siemens, ElectricConductanceUnit.Siemens, quantity => quantity); @@ -536,8 +535,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricConductance objElectricConductance)) throw new ArgumentException("Expected type ElectricConductance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricConductance objElectricConductance)) throw new ArgumentException("Expected type ElectricConductance.", nameof(obj)); return CompareTo(objElectricConductance); } @@ -552,7 +551,7 @@ public int CompareTo(ElectricConductance other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricConductance objElectricConductance)) + if (obj is null || !(obj is ElectricConductance objElectricConductance)) return false; return Equals(objElectricConductance); @@ -607,7 +606,7 @@ public bool Equals(ElectricConductance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricConductance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -635,7 +634,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricConductanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -645,13 +644,13 @@ public double As(ElectricConductanceUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -660,7 +659,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricConductanceUnit unitAsElectricConductanceUnit)) + if (!(unit is ElectricConductanceUnit unitAsElectricConductanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricConductanceUnit)} is supported.", nameof(unit)); return As(unitAsElectricConductanceUnit); @@ -684,18 +683,18 @@ public ElectricConductance ToUnit(ElectricConductanceUnit unit) /// A ElectricConductance with the specified unit. public ElectricConductance ToUnit(ElectricConductanceUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricConductance), Unit, typeof(ElectricConductance), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricConductance), Unit, typeof(ElectricConductance), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricConductance)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -710,7 +709,7 @@ public ElectricConductance ToUnit(ElectricConductanceUnit unit, UnitConverter un /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricConductanceUnit unitAsElectricConductanceUnit)) + if (!(unit is ElectricConductanceUnit unitAsElectricConductanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricConductanceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricConductanceUnit, DefaultConversionFunctions); @@ -719,7 +718,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricConductanceUnit unitAsElectricConductanceUnit)) + if (!(unit is ElectricConductanceUnit unitAsElectricConductanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricConductanceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricConductanceUnit, unitConverter); @@ -728,13 +727,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricConductance ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -909,15 +908,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricConductance)) + if (conversionType == typeof(ElectricConductance)) return this; - else if(conversionType == typeof(ElectricConductanceUnit)) + else if (conversionType == typeof(ElectricConductanceUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricConductance.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricConductance.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricConductance.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs index f8bf3ba190..746ab1905a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -84,7 +84,7 @@ static ElectricConductivity() /// If value is NaN or Infinity. public ElectricConductivity(double value, ElectricConductivityUnit unit) { - if(unit == ElectricConductivityUnit.Undefined) + if (unit == ElectricConductivityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -101,7 +101,7 @@ public ElectricConductivity(double value, ElectricConductivityUnit unit) /// No unit was found for the given . public ElectricConductivity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -221,7 +221,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) // Register in unit converter: BaseUnit -> ElectricConductivityUnit unitConverter.SetConversionFunction(ElectricConductivityUnit.SiemensPerMeter, ElectricConductivityUnit.SiemensPerFoot, quantity => new ElectricConductivity(quantity.Value / 3.2808398950131234, ElectricConductivityUnit.SiemensPerFoot)); unitConverter.SetConversionFunction(ElectricConductivityUnit.SiemensPerMeter, ElectricConductivityUnit.SiemensPerInch, quantity => new ElectricConductivity(quantity.Value / 3.937007874015748e1, ElectricConductivityUnit.SiemensPerInch)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricConductivityUnit.SiemensPerMeter, ElectricConductivityUnit.SiemensPerMeter, quantity => quantity); @@ -536,8 +535,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricConductivity objElectricConductivity)) throw new ArgumentException("Expected type ElectricConductivity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricConductivity objElectricConductivity)) throw new ArgumentException("Expected type ElectricConductivity.", nameof(obj)); return CompareTo(objElectricConductivity); } @@ -552,7 +551,7 @@ public int CompareTo(ElectricConductivity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricConductivity objElectricConductivity)) + if (obj is null || !(obj is ElectricConductivity objElectricConductivity)) return false; return Equals(objElectricConductivity); @@ -607,7 +606,7 @@ public bool Equals(ElectricConductivity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricConductivity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -635,7 +634,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricConductivityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -645,13 +644,13 @@ public double As(ElectricConductivityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -660,7 +659,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricConductivityUnit unitAsElectricConductivityUnit)) + if (!(unit is ElectricConductivityUnit unitAsElectricConductivityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricConductivityUnit)} is supported.", nameof(unit)); return As(unitAsElectricConductivityUnit); @@ -684,18 +683,18 @@ public ElectricConductivity ToUnit(ElectricConductivityUnit unit) /// A ElectricConductivity with the specified unit. public ElectricConductivity ToUnit(ElectricConductivityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricConductivity), Unit, typeof(ElectricConductivity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricConductivity), Unit, typeof(ElectricConductivity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricConductivity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -710,7 +709,7 @@ public ElectricConductivity ToUnit(ElectricConductivityUnit unit, UnitConverter /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricConductivityUnit unitAsElectricConductivityUnit)) + if (!(unit is ElectricConductivityUnit unitAsElectricConductivityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricConductivityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricConductivityUnit, DefaultConversionFunctions); @@ -719,7 +718,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricConductivityUnit unitAsElectricConductivityUnit)) + if (!(unit is ElectricConductivityUnit unitAsElectricConductivityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricConductivityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricConductivityUnit, unitConverter); @@ -728,13 +727,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricConductivity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -909,15 +908,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricConductivity)) + if (conversionType == typeof(ElectricConductivity)) return this; - else if(conversionType == typeof(ElectricConductivityUnit)) + else if (conversionType == typeof(ElectricConductivityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricConductivity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricConductivity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricConductivity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs index a912816bbc..91952c9409 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -86,7 +86,7 @@ static ElectricCurrent() /// If value is NaN or Infinity. public ElectricCurrent(double value, ElectricCurrentUnit unit) { - if(unit == ElectricCurrentUnit.Undefined) + if (unit == ElectricCurrentUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -103,7 +103,7 @@ public ElectricCurrent(double value, ElectricCurrentUnit unit) /// No unit was found for the given . public ElectricCurrent(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -253,7 +253,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ElectricCurrentUnit.Ampere, ElectricCurrentUnit.Milliampere, quantity => new ElectricCurrent((quantity.Value) / 1e-3d, ElectricCurrentUnit.Milliampere)); unitConverter.SetConversionFunction(ElectricCurrentUnit.Ampere, ElectricCurrentUnit.Nanoampere, quantity => new ElectricCurrent((quantity.Value) / 1e-9d, ElectricCurrentUnit.Nanoampere)); unitConverter.SetConversionFunction(ElectricCurrentUnit.Ampere, ElectricCurrentUnit.Picoampere, quantity => new ElectricCurrent((quantity.Value) / 1e-12d, ElectricCurrentUnit.Picoampere)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricCurrentUnit.Ampere, ElectricCurrentUnit.Ampere, quantity => quantity); @@ -623,8 +622,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrent objElectricCurrent)) throw new ArgumentException("Expected type ElectricCurrent.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricCurrent objElectricCurrent)) throw new ArgumentException("Expected type ElectricCurrent.", nameof(obj)); return CompareTo(objElectricCurrent); } @@ -639,7 +638,7 @@ public int CompareTo(ElectricCurrent other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricCurrent objElectricCurrent)) + if (obj is null || !(obj is ElectricCurrent objElectricCurrent)) return false; return Equals(objElectricCurrent); @@ -694,7 +693,7 @@ public bool Equals(ElectricCurrent other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricCurrent other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -722,7 +721,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricCurrentUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -732,13 +731,13 @@ public double As(ElectricCurrentUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -747,7 +746,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricCurrentUnit unitAsElectricCurrentUnit)) + if (!(unit is ElectricCurrentUnit unitAsElectricCurrentUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentUnit)} is supported.", nameof(unit)); return As(unitAsElectricCurrentUnit); @@ -771,18 +770,18 @@ public ElectricCurrent ToUnit(ElectricCurrentUnit unit) /// A ElectricCurrent with the specified unit. public ElectricCurrent ToUnit(ElectricCurrentUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricCurrent), Unit, typeof(ElectricCurrent), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricCurrent), Unit, typeof(ElectricCurrent), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricCurrent)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -797,7 +796,7 @@ public ElectricCurrent ToUnit(ElectricCurrentUnit unit, UnitConverter unitConver /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricCurrentUnit unitAsElectricCurrentUnit)) + if (!(unit is ElectricCurrentUnit unitAsElectricCurrentUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricCurrentUnit, DefaultConversionFunctions); @@ -806,7 +805,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricCurrentUnit unitAsElectricCurrentUnit)) + if (!(unit is ElectricCurrentUnit unitAsElectricCurrentUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricCurrentUnit, unitConverter); @@ -815,13 +814,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricCurrent ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -996,15 +995,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricCurrent)) + if (conversionType == typeof(ElectricCurrent)) return this; - else if(conversionType == typeof(ElectricCurrentUnit)) + else if (conversionType == typeof(ElectricCurrentUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricCurrent.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricCurrent.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricCurrent.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs index 7222179c6e..aecb8fc3b4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs @@ -84,7 +84,7 @@ static ElectricCurrentDensity() /// If value is NaN or Infinity. public ElectricCurrentDensity(double value, ElectricCurrentDensityUnit unit) { - if(unit == ElectricCurrentDensityUnit.Undefined) + if (unit == ElectricCurrentDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -101,7 +101,7 @@ public ElectricCurrentDensity(double value, ElectricCurrentDensityUnit unit) /// No unit was found for the given . public ElectricCurrentDensity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -221,7 +221,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) // Register in unit converter: BaseUnit -> ElectricCurrentDensityUnit unitConverter.SetConversionFunction(ElectricCurrentDensityUnit.AmperePerSquareMeter, ElectricCurrentDensityUnit.AmperePerSquareFoot, quantity => new ElectricCurrentDensity(quantity.Value / 1.0763910416709722e1, ElectricCurrentDensityUnit.AmperePerSquareFoot)); unitConverter.SetConversionFunction(ElectricCurrentDensityUnit.AmperePerSquareMeter, ElectricCurrentDensityUnit.AmperePerSquareInch, quantity => new ElectricCurrentDensity(quantity.Value / 1.5500031000062000e3, ElectricCurrentDensityUnit.AmperePerSquareInch)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricCurrentDensityUnit.AmperePerSquareMeter, ElectricCurrentDensityUnit.AmperePerSquareMeter, quantity => quantity); @@ -536,8 +535,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrentDensity objElectricCurrentDensity)) throw new ArgumentException("Expected type ElectricCurrentDensity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricCurrentDensity objElectricCurrentDensity)) throw new ArgumentException("Expected type ElectricCurrentDensity.", nameof(obj)); return CompareTo(objElectricCurrentDensity); } @@ -552,7 +551,7 @@ public int CompareTo(ElectricCurrentDensity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricCurrentDensity objElectricCurrentDensity)) + if (obj is null || !(obj is ElectricCurrentDensity objElectricCurrentDensity)) return false; return Equals(objElectricCurrentDensity); @@ -607,7 +606,7 @@ public bool Equals(ElectricCurrentDensity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricCurrentDensity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -635,7 +634,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricCurrentDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -645,13 +644,13 @@ public double As(ElectricCurrentDensityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -660,7 +659,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricCurrentDensityUnit unitAsElectricCurrentDensityUnit)) + if (!(unit is ElectricCurrentDensityUnit unitAsElectricCurrentDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentDensityUnit)} is supported.", nameof(unit)); return As(unitAsElectricCurrentDensityUnit); @@ -684,18 +683,18 @@ public ElectricCurrentDensity ToUnit(ElectricCurrentDensityUnit unit) /// A ElectricCurrentDensity with the specified unit. public ElectricCurrentDensity ToUnit(ElectricCurrentDensityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricCurrentDensity), Unit, typeof(ElectricCurrentDensity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricCurrentDensity), Unit, typeof(ElectricCurrentDensity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricCurrentDensity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -710,7 +709,7 @@ public ElectricCurrentDensity ToUnit(ElectricCurrentDensityUnit unit, UnitConver /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricCurrentDensityUnit unitAsElectricCurrentDensityUnit)) + if (!(unit is ElectricCurrentDensityUnit unitAsElectricCurrentDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentDensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricCurrentDensityUnit, DefaultConversionFunctions); @@ -719,7 +718,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricCurrentDensityUnit unitAsElectricCurrentDensityUnit)) + if (!(unit is ElectricCurrentDensityUnit unitAsElectricCurrentDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentDensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricCurrentDensityUnit, unitConverter); @@ -728,13 +727,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricCurrentDensity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -909,15 +908,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricCurrentDensity)) + if (conversionType == typeof(ElectricCurrentDensity)) return this; - else if(conversionType == typeof(ElectricCurrentDensityUnit)) + else if (conversionType == typeof(ElectricCurrentDensityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricCurrentDensity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricCurrentDensity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricCurrentDensity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs index 5fc998eade..3e410092f7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -82,7 +82,7 @@ static ElectricCurrentGradient() /// If value is NaN or Infinity. public ElectricCurrentGradient(double value, ElectricCurrentGradientUnit unit) { - if(unit == ElectricCurrentGradientUnit.Undefined) + if (unit == ElectricCurrentGradientUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public ElectricCurrentGradient(double value, ElectricCurrentGradientUnit unit) /// No unit was found for the given . public ElectricCurrentGradient(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -225,7 +225,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ElectricCurrentGradientUnit.AmperePerSecond, ElectricCurrentGradientUnit.AmperePerMicrosecond, quantity => new ElectricCurrentGradient(quantity.Value/1E6, ElectricCurrentGradientUnit.AmperePerMicrosecond)); unitConverter.SetConversionFunction(ElectricCurrentGradientUnit.AmperePerSecond, ElectricCurrentGradientUnit.AmperePerMillisecond, quantity => new ElectricCurrentGradient(quantity.Value/1E3, ElectricCurrentGradientUnit.AmperePerMillisecond)); unitConverter.SetConversionFunction(ElectricCurrentGradientUnit.AmperePerSecond, ElectricCurrentGradientUnit.AmperePerNanosecond, quantity => new ElectricCurrentGradient(quantity.Value/1E9, ElectricCurrentGradientUnit.AmperePerNanosecond)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricCurrentGradientUnit.AmperePerSecond, ElectricCurrentGradientUnit.AmperePerSecond, quantity => quantity); @@ -551,8 +550,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrentGradient objElectricCurrentGradient)) throw new ArgumentException("Expected type ElectricCurrentGradient.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricCurrentGradient objElectricCurrentGradient)) throw new ArgumentException("Expected type ElectricCurrentGradient.", nameof(obj)); return CompareTo(objElectricCurrentGradient); } @@ -567,7 +566,7 @@ public int CompareTo(ElectricCurrentGradient other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricCurrentGradient objElectricCurrentGradient)) + if (obj is null || !(obj is ElectricCurrentGradient objElectricCurrentGradient)) return false; return Equals(objElectricCurrentGradient); @@ -622,7 +621,7 @@ public bool Equals(ElectricCurrentGradient other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricCurrentGradient other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -650,7 +649,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricCurrentGradientUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -660,13 +659,13 @@ public double As(ElectricCurrentGradientUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -675,7 +674,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricCurrentGradientUnit unitAsElectricCurrentGradientUnit)) + if (!(unit is ElectricCurrentGradientUnit unitAsElectricCurrentGradientUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentGradientUnit)} is supported.", nameof(unit)); return As(unitAsElectricCurrentGradientUnit); @@ -699,18 +698,18 @@ public ElectricCurrentGradient ToUnit(ElectricCurrentGradientUnit unit) /// A ElectricCurrentGradient with the specified unit. public ElectricCurrentGradient ToUnit(ElectricCurrentGradientUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricCurrentGradient), Unit, typeof(ElectricCurrentGradient), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricCurrentGradient), Unit, typeof(ElectricCurrentGradient), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricCurrentGradient)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -725,7 +724,7 @@ public ElectricCurrentGradient ToUnit(ElectricCurrentGradientUnit unit, UnitConv /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricCurrentGradientUnit unitAsElectricCurrentGradientUnit)) + if (!(unit is ElectricCurrentGradientUnit unitAsElectricCurrentGradientUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentGradientUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricCurrentGradientUnit, DefaultConversionFunctions); @@ -734,7 +733,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricCurrentGradientUnit unitAsElectricCurrentGradientUnit)) + if (!(unit is ElectricCurrentGradientUnit unitAsElectricCurrentGradientUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentGradientUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricCurrentGradientUnit, unitConverter); @@ -743,13 +742,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricCurrentGradient ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -924,15 +923,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricCurrentGradient)) + if (conversionType == typeof(ElectricCurrentGradient)) return this; - else if(conversionType == typeof(ElectricCurrentGradientUnit)) + else if (conversionType == typeof(ElectricCurrentGradientUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricCurrentGradient.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricCurrentGradient.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricCurrentGradient.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs index 6ea4e55668..703a875b7b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs @@ -82,7 +82,7 @@ static ElectricField() /// If value is NaN or Infinity. public ElectricField(double value, ElectricFieldUnit unit) { - if(unit == ElectricFieldUnit.Undefined) + if (unit == ElectricFieldUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public ElectricField(double value, ElectricFieldUnit unit) /// No unit was found for the given . public ElectricField(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -207,7 +207,6 @@ public ElectricField(double value, UnitSystem unitSystem) internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> ElectricFieldUnit - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricFieldUnit.VoltPerMeter, ElectricFieldUnit.VoltPerMeter, quantity => quantity); @@ -500,8 +499,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricField objElectricField)) throw new ArgumentException("Expected type ElectricField.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricField objElectricField)) throw new ArgumentException("Expected type ElectricField.", nameof(obj)); return CompareTo(objElectricField); } @@ -516,7 +515,7 @@ public int CompareTo(ElectricField other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricField objElectricField)) + if (obj is null || !(obj is ElectricField objElectricField)) return false; return Equals(objElectricField); @@ -571,7 +570,7 @@ public bool Equals(ElectricField other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricField other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -599,7 +598,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricFieldUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -609,13 +608,13 @@ public double As(ElectricFieldUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -624,7 +623,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricFieldUnit unitAsElectricFieldUnit)) + if (!(unit is ElectricFieldUnit unitAsElectricFieldUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricFieldUnit)} is supported.", nameof(unit)); return As(unitAsElectricFieldUnit); @@ -648,18 +647,18 @@ public ElectricField ToUnit(ElectricFieldUnit unit) /// A ElectricField with the specified unit. public ElectricField ToUnit(ElectricFieldUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricField), Unit, typeof(ElectricField), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricField), Unit, typeof(ElectricField), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricField)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -674,7 +673,7 @@ public ElectricField ToUnit(ElectricFieldUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricFieldUnit unitAsElectricFieldUnit)) + if (!(unit is ElectricFieldUnit unitAsElectricFieldUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricFieldUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricFieldUnit, DefaultConversionFunctions); @@ -683,7 +682,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricFieldUnit unitAsElectricFieldUnit)) + if (!(unit is ElectricFieldUnit unitAsElectricFieldUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricFieldUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricFieldUnit, unitConverter); @@ -692,13 +691,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricField ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -873,15 +872,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricField)) + if (conversionType == typeof(ElectricField)) return this; - else if(conversionType == typeof(ElectricFieldUnit)) + else if (conversionType == typeof(ElectricFieldUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricField.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricField.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricField.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricField)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs index e77ede6790..f36c7b0bd1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs @@ -85,7 +85,7 @@ static ElectricInductance() /// If value is NaN or Infinity. public ElectricInductance(double value, ElectricInductanceUnit unit) { - if(unit == ElectricInductanceUnit.Undefined) + if (unit == ElectricInductanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -102,7 +102,7 @@ public ElectricInductance(double value, ElectricInductanceUnit unit) /// No unit was found for the given . public ElectricInductance(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -228,7 +228,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ElectricInductanceUnit.Henry, ElectricInductanceUnit.Microhenry, quantity => new ElectricInductance((quantity.Value) / 1e-6d, ElectricInductanceUnit.Microhenry)); unitConverter.SetConversionFunction(ElectricInductanceUnit.Henry, ElectricInductanceUnit.Millihenry, quantity => new ElectricInductance((quantity.Value) / 1e-3d, ElectricInductanceUnit.Millihenry)); unitConverter.SetConversionFunction(ElectricInductanceUnit.Henry, ElectricInductanceUnit.Nanohenry, quantity => new ElectricInductance((quantity.Value) / 1e-9d, ElectricInductanceUnit.Nanohenry)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricInductanceUnit.Henry, ElectricInductanceUnit.Henry, quantity => quantity); @@ -554,8 +553,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricInductance objElectricInductance)) throw new ArgumentException("Expected type ElectricInductance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricInductance objElectricInductance)) throw new ArgumentException("Expected type ElectricInductance.", nameof(obj)); return CompareTo(objElectricInductance); } @@ -570,7 +569,7 @@ public int CompareTo(ElectricInductance other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricInductance objElectricInductance)) + if (obj is null || !(obj is ElectricInductance objElectricInductance)) return false; return Equals(objElectricInductance); @@ -625,7 +624,7 @@ public bool Equals(ElectricInductance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricInductance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -653,7 +652,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricInductanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -663,13 +662,13 @@ public double As(ElectricInductanceUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -678,7 +677,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricInductanceUnit unitAsElectricInductanceUnit)) + if (!(unit is ElectricInductanceUnit unitAsElectricInductanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricInductanceUnit)} is supported.", nameof(unit)); return As(unitAsElectricInductanceUnit); @@ -702,18 +701,18 @@ public ElectricInductance ToUnit(ElectricInductanceUnit unit) /// A ElectricInductance with the specified unit. public ElectricInductance ToUnit(ElectricInductanceUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricInductance), Unit, typeof(ElectricInductance), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricInductance), Unit, typeof(ElectricInductance), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricInductance)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -728,7 +727,7 @@ public ElectricInductance ToUnit(ElectricInductanceUnit unit, UnitConverter unit /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricInductanceUnit unitAsElectricInductanceUnit)) + if (!(unit is ElectricInductanceUnit unitAsElectricInductanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricInductanceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricInductanceUnit, DefaultConversionFunctions); @@ -737,7 +736,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricInductanceUnit unitAsElectricInductanceUnit)) + if (!(unit is ElectricInductanceUnit unitAsElectricInductanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricInductanceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricInductanceUnit, unitConverter); @@ -746,13 +745,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricInductance ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -927,15 +926,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricInductance)) + if (conversionType == typeof(ElectricInductance)) return this; - else if(conversionType == typeof(ElectricInductanceUnit)) + else if (conversionType == typeof(ElectricInductanceUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricInductance.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricInductance.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricInductance.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs index 00a0917376..df81062943 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -83,7 +83,7 @@ static ElectricPotential() /// If value is NaN or Infinity. public ElectricPotential(double value, ElectricPotentialUnit unit) { - if(unit == ElectricPotentialUnit.Undefined) + if (unit == ElectricPotentialUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -100,7 +100,7 @@ public ElectricPotential(double value, ElectricPotentialUnit unit) /// No unit was found for the given . public ElectricPotential(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -232,7 +232,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ElectricPotentialUnit.Volt, ElectricPotentialUnit.Megavolt, quantity => new ElectricPotential((quantity.Value) / 1e6d, ElectricPotentialUnit.Megavolt)); unitConverter.SetConversionFunction(ElectricPotentialUnit.Volt, ElectricPotentialUnit.Microvolt, quantity => new ElectricPotential((quantity.Value) / 1e-6d, ElectricPotentialUnit.Microvolt)); unitConverter.SetConversionFunction(ElectricPotentialUnit.Volt, ElectricPotentialUnit.Millivolt, quantity => new ElectricPotential((quantity.Value) / 1e-3d, ElectricPotentialUnit.Millivolt)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricPotentialUnit.Volt, ElectricPotentialUnit.Volt, quantity => quantity); @@ -574,8 +573,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotential objElectricPotential)) throw new ArgumentException("Expected type ElectricPotential.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricPotential objElectricPotential)) throw new ArgumentException("Expected type ElectricPotential.", nameof(obj)); return CompareTo(objElectricPotential); } @@ -590,7 +589,7 @@ public int CompareTo(ElectricPotential other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricPotential objElectricPotential)) + if (obj is null || !(obj is ElectricPotential objElectricPotential)) return false; return Equals(objElectricPotential); @@ -645,7 +644,7 @@ public bool Equals(ElectricPotential other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricPotential other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -673,7 +672,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricPotentialUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -683,13 +682,13 @@ public double As(ElectricPotentialUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -698,7 +697,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricPotentialUnit unitAsElectricPotentialUnit)) + if (!(unit is ElectricPotentialUnit unitAsElectricPotentialUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialUnit)} is supported.", nameof(unit)); return As(unitAsElectricPotentialUnit); @@ -722,18 +721,18 @@ public ElectricPotential ToUnit(ElectricPotentialUnit unit) /// A ElectricPotential with the specified unit. public ElectricPotential ToUnit(ElectricPotentialUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricPotential), Unit, typeof(ElectricPotential), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricPotential), Unit, typeof(ElectricPotential), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricPotential)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -748,7 +747,7 @@ public ElectricPotential ToUnit(ElectricPotentialUnit unit, UnitConverter unitCo /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricPotentialUnit unitAsElectricPotentialUnit)) + if (!(unit is ElectricPotentialUnit unitAsElectricPotentialUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricPotentialUnit, DefaultConversionFunctions); @@ -757,7 +756,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricPotentialUnit unitAsElectricPotentialUnit)) + if (!(unit is ElectricPotentialUnit unitAsElectricPotentialUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricPotentialUnit, unitConverter); @@ -766,13 +765,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricPotential ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -947,15 +946,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricPotential)) + if (conversionType == typeof(ElectricPotential)) return this; - else if(conversionType == typeof(ElectricPotentialUnit)) + else if (conversionType == typeof(ElectricPotentialUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricPotential.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricPotential.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricPotential.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs index 732a127621..5375bb6e8f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs @@ -83,7 +83,7 @@ static ElectricPotentialAc() /// If value is NaN or Infinity. public ElectricPotentialAc(double value, ElectricPotentialAcUnit unit) { - if(unit == ElectricPotentialAcUnit.Undefined) + if (unit == ElectricPotentialAcUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -100,7 +100,7 @@ public ElectricPotentialAc(double value, ElectricPotentialAcUnit unit) /// No unit was found for the given . public ElectricPotentialAc(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -232,7 +232,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ElectricPotentialAcUnit.VoltAc, ElectricPotentialAcUnit.MegavoltAc, quantity => new ElectricPotentialAc((quantity.Value) / 1e6d, ElectricPotentialAcUnit.MegavoltAc)); unitConverter.SetConversionFunction(ElectricPotentialAcUnit.VoltAc, ElectricPotentialAcUnit.MicrovoltAc, quantity => new ElectricPotentialAc((quantity.Value) / 1e-6d, ElectricPotentialAcUnit.MicrovoltAc)); unitConverter.SetConversionFunction(ElectricPotentialAcUnit.VoltAc, ElectricPotentialAcUnit.MillivoltAc, quantity => new ElectricPotentialAc((quantity.Value) / 1e-3d, ElectricPotentialAcUnit.MillivoltAc)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricPotentialAcUnit.VoltAc, ElectricPotentialAcUnit.VoltAc, quantity => quantity); @@ -569,8 +568,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotentialAc objElectricPotentialAc)) throw new ArgumentException("Expected type ElectricPotentialAc.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricPotentialAc objElectricPotentialAc)) throw new ArgumentException("Expected type ElectricPotentialAc.", nameof(obj)); return CompareTo(objElectricPotentialAc); } @@ -585,7 +584,7 @@ public int CompareTo(ElectricPotentialAc other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricPotentialAc objElectricPotentialAc)) + if (obj is null || !(obj is ElectricPotentialAc objElectricPotentialAc)) return false; return Equals(objElectricPotentialAc); @@ -640,7 +639,7 @@ public bool Equals(ElectricPotentialAc other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricPotentialAc other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -668,7 +667,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricPotentialAcUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -678,13 +677,13 @@ public double As(ElectricPotentialAcUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -693,7 +692,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricPotentialAcUnit unitAsElectricPotentialAcUnit)) + if (!(unit is ElectricPotentialAcUnit unitAsElectricPotentialAcUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialAcUnit)} is supported.", nameof(unit)); return As(unitAsElectricPotentialAcUnit); @@ -717,18 +716,18 @@ public ElectricPotentialAc ToUnit(ElectricPotentialAcUnit unit) /// A ElectricPotentialAc with the specified unit. public ElectricPotentialAc ToUnit(ElectricPotentialAcUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricPotentialAc), Unit, typeof(ElectricPotentialAc), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricPotentialAc), Unit, typeof(ElectricPotentialAc), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricPotentialAc)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -743,7 +742,7 @@ public ElectricPotentialAc ToUnit(ElectricPotentialAcUnit unit, UnitConverter un /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricPotentialAcUnit unitAsElectricPotentialAcUnit)) + if (!(unit is ElectricPotentialAcUnit unitAsElectricPotentialAcUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialAcUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricPotentialAcUnit, DefaultConversionFunctions); @@ -752,7 +751,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricPotentialAcUnit unitAsElectricPotentialAcUnit)) + if (!(unit is ElectricPotentialAcUnit unitAsElectricPotentialAcUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialAcUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricPotentialAcUnit, unitConverter); @@ -761,13 +760,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricPotentialAc ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -942,15 +941,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricPotentialAc)) + if (conversionType == typeof(ElectricPotentialAc)) return this; - else if(conversionType == typeof(ElectricPotentialAcUnit)) + else if (conversionType == typeof(ElectricPotentialAcUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricPotentialAc.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricPotentialAc.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricPotentialAc.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs index ae38eed039..dcd17b9ff2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs @@ -98,7 +98,7 @@ static ElectricPotentialChangeRate() /// If value is NaN or Infinity. public ElectricPotentialChangeRate(double value, ElectricPotentialChangeRateUnit unit) { - if(unit == ElectricPotentialChangeRateUnit.Undefined) + if (unit == ElectricPotentialChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -115,7 +115,7 @@ public ElectricPotentialChangeRate(double value, ElectricPotentialChangeRateUnit /// No unit was found for the given . public ElectricPotentialChangeRate(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -337,7 +337,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ElectricPotentialChangeRateUnit.VoltPerSecond, ElectricPotentialChangeRateUnit.VoltPerHour, quantity => new ElectricPotentialChangeRate(quantity.Value*3600, ElectricPotentialChangeRateUnit.VoltPerHour)); unitConverter.SetConversionFunction(ElectricPotentialChangeRateUnit.VoltPerSecond, ElectricPotentialChangeRateUnit.VoltPerMicrosecond, quantity => new ElectricPotentialChangeRate(quantity.Value/1E6, ElectricPotentialChangeRateUnit.VoltPerMicrosecond)); unitConverter.SetConversionFunction(ElectricPotentialChangeRateUnit.VoltPerSecond, ElectricPotentialChangeRateUnit.VoltPerMinute, quantity => new ElectricPotentialChangeRate(quantity.Value*60, ElectricPotentialChangeRateUnit.VoltPerMinute)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricPotentialChangeRateUnit.VoltPerSecond, ElectricPotentialChangeRateUnit.VoltPerSecond, quantity => quantity); @@ -839,8 +838,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotentialChangeRate objElectricPotentialChangeRate)) throw new ArgumentException("Expected type ElectricPotentialChangeRate.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricPotentialChangeRate objElectricPotentialChangeRate)) throw new ArgumentException("Expected type ElectricPotentialChangeRate.", nameof(obj)); return CompareTo(objElectricPotentialChangeRate); } @@ -855,7 +854,7 @@ public int CompareTo(ElectricPotentialChangeRate other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricPotentialChangeRate objElectricPotentialChangeRate)) + if (obj is null || !(obj is ElectricPotentialChangeRate objElectricPotentialChangeRate)) return false; return Equals(objElectricPotentialChangeRate); @@ -910,7 +909,7 @@ public bool Equals(ElectricPotentialChangeRate other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricPotentialChangeRate other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -938,7 +937,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricPotentialChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -948,13 +947,13 @@ public double As(ElectricPotentialChangeRateUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -963,7 +962,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricPotentialChangeRateUnit unitAsElectricPotentialChangeRateUnit)) + if (!(unit is ElectricPotentialChangeRateUnit unitAsElectricPotentialChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialChangeRateUnit)} is supported.", nameof(unit)); return As(unitAsElectricPotentialChangeRateUnit); @@ -987,18 +986,18 @@ public ElectricPotentialChangeRate ToUnit(ElectricPotentialChangeRateUnit unit) /// A ElectricPotentialChangeRate with the specified unit. public ElectricPotentialChangeRate ToUnit(ElectricPotentialChangeRateUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricPotentialChangeRate), Unit, typeof(ElectricPotentialChangeRate), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricPotentialChangeRate), Unit, typeof(ElectricPotentialChangeRate), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricPotentialChangeRate)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1013,7 +1012,7 @@ public ElectricPotentialChangeRate ToUnit(ElectricPotentialChangeRateUnit unit, /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricPotentialChangeRateUnit unitAsElectricPotentialChangeRateUnit)) + if (!(unit is ElectricPotentialChangeRateUnit unitAsElectricPotentialChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialChangeRateUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricPotentialChangeRateUnit, DefaultConversionFunctions); @@ -1022,7 +1021,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricPotentialChangeRateUnit unitAsElectricPotentialChangeRateUnit)) + if (!(unit is ElectricPotentialChangeRateUnit unitAsElectricPotentialChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialChangeRateUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricPotentialChangeRateUnit, unitConverter); @@ -1031,13 +1030,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricPotentialChangeRate ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1212,15 +1211,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricPotentialChangeRate)) + if (conversionType == typeof(ElectricPotentialChangeRate)) return this; - else if(conversionType == typeof(ElectricPotentialChangeRateUnit)) + else if (conversionType == typeof(ElectricPotentialChangeRateUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricPotentialChangeRate.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricPotentialChangeRate.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricPotentialChangeRate.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricPotentialChangeRate)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs index 7b16c8ad6a..6c3873a309 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs @@ -83,7 +83,7 @@ static ElectricPotentialDc() /// If value is NaN or Infinity. public ElectricPotentialDc(double value, ElectricPotentialDcUnit unit) { - if(unit == ElectricPotentialDcUnit.Undefined) + if (unit == ElectricPotentialDcUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -100,7 +100,7 @@ public ElectricPotentialDc(double value, ElectricPotentialDcUnit unit) /// No unit was found for the given . public ElectricPotentialDc(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -232,7 +232,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ElectricPotentialDcUnit.VoltDc, ElectricPotentialDcUnit.MegavoltDc, quantity => new ElectricPotentialDc((quantity.Value) / 1e6d, ElectricPotentialDcUnit.MegavoltDc)); unitConverter.SetConversionFunction(ElectricPotentialDcUnit.VoltDc, ElectricPotentialDcUnit.MicrovoltDc, quantity => new ElectricPotentialDc((quantity.Value) / 1e-6d, ElectricPotentialDcUnit.MicrovoltDc)); unitConverter.SetConversionFunction(ElectricPotentialDcUnit.VoltDc, ElectricPotentialDcUnit.MillivoltDc, quantity => new ElectricPotentialDc((quantity.Value) / 1e-3d, ElectricPotentialDcUnit.MillivoltDc)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricPotentialDcUnit.VoltDc, ElectricPotentialDcUnit.VoltDc, quantity => quantity); @@ -569,8 +568,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotentialDc objElectricPotentialDc)) throw new ArgumentException("Expected type ElectricPotentialDc.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricPotentialDc objElectricPotentialDc)) throw new ArgumentException("Expected type ElectricPotentialDc.", nameof(obj)); return CompareTo(objElectricPotentialDc); } @@ -585,7 +584,7 @@ public int CompareTo(ElectricPotentialDc other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricPotentialDc objElectricPotentialDc)) + if (obj is null || !(obj is ElectricPotentialDc objElectricPotentialDc)) return false; return Equals(objElectricPotentialDc); @@ -640,7 +639,7 @@ public bool Equals(ElectricPotentialDc other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricPotentialDc other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -668,7 +667,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricPotentialDcUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -678,13 +677,13 @@ public double As(ElectricPotentialDcUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -693,7 +692,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricPotentialDcUnit unitAsElectricPotentialDcUnit)) + if (!(unit is ElectricPotentialDcUnit unitAsElectricPotentialDcUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialDcUnit)} is supported.", nameof(unit)); return As(unitAsElectricPotentialDcUnit); @@ -717,18 +716,18 @@ public ElectricPotentialDc ToUnit(ElectricPotentialDcUnit unit) /// A ElectricPotentialDc with the specified unit. public ElectricPotentialDc ToUnit(ElectricPotentialDcUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricPotentialDc), Unit, typeof(ElectricPotentialDc), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricPotentialDc), Unit, typeof(ElectricPotentialDc), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricPotentialDc)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -743,7 +742,7 @@ public ElectricPotentialDc ToUnit(ElectricPotentialDcUnit unit, UnitConverter un /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricPotentialDcUnit unitAsElectricPotentialDcUnit)) + if (!(unit is ElectricPotentialDcUnit unitAsElectricPotentialDcUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialDcUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricPotentialDcUnit, DefaultConversionFunctions); @@ -752,7 +751,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricPotentialDcUnit unitAsElectricPotentialDcUnit)) + if (!(unit is ElectricPotentialDcUnit unitAsElectricPotentialDcUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialDcUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricPotentialDcUnit, unitConverter); @@ -761,13 +760,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricPotentialDc ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -942,15 +941,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricPotentialDc)) + if (conversionType == typeof(ElectricPotentialDc)) return this; - else if(conversionType == typeof(ElectricPotentialDcUnit)) + else if (conversionType == typeof(ElectricPotentialDcUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricPotentialDc.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricPotentialDc.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricPotentialDc.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs index 9f5c088450..e9a326871d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -84,7 +84,7 @@ static ElectricResistance() /// If value is NaN or Infinity. public ElectricResistance(double value, ElectricResistanceUnit unit) { - if(unit == ElectricResistanceUnit.Undefined) + if (unit == ElectricResistanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -101,7 +101,7 @@ public ElectricResistance(double value, ElectricResistanceUnit unit) /// No unit was found for the given . public ElectricResistance(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -239,7 +239,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ElectricResistanceUnit.Ohm, ElectricResistanceUnit.Megaohm, quantity => new ElectricResistance((quantity.Value) / 1e6d, ElectricResistanceUnit.Megaohm)); unitConverter.SetConversionFunction(ElectricResistanceUnit.Ohm, ElectricResistanceUnit.Microohm, quantity => new ElectricResistance((quantity.Value) / 1e-6d, ElectricResistanceUnit.Microohm)); unitConverter.SetConversionFunction(ElectricResistanceUnit.Ohm, ElectricResistanceUnit.Milliohm, quantity => new ElectricResistance((quantity.Value) / 1e-3d, ElectricResistanceUnit.Milliohm)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricResistanceUnit.Ohm, ElectricResistanceUnit.Ohm, quantity => quantity); @@ -587,8 +586,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricResistance objElectricResistance)) throw new ArgumentException("Expected type ElectricResistance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricResistance objElectricResistance)) throw new ArgumentException("Expected type ElectricResistance.", nameof(obj)); return CompareTo(objElectricResistance); } @@ -603,7 +602,7 @@ public int CompareTo(ElectricResistance other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricResistance objElectricResistance)) + if (obj is null || !(obj is ElectricResistance objElectricResistance)) return false; return Equals(objElectricResistance); @@ -658,7 +657,7 @@ public bool Equals(ElectricResistance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricResistance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -686,7 +685,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricResistanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -696,13 +695,13 @@ public double As(ElectricResistanceUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -711,7 +710,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricResistanceUnit unitAsElectricResistanceUnit)) + if (!(unit is ElectricResistanceUnit unitAsElectricResistanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricResistanceUnit)} is supported.", nameof(unit)); return As(unitAsElectricResistanceUnit); @@ -735,18 +734,18 @@ public ElectricResistance ToUnit(ElectricResistanceUnit unit) /// A ElectricResistance with the specified unit. public ElectricResistance ToUnit(ElectricResistanceUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricResistance), Unit, typeof(ElectricResistance), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricResistance), Unit, typeof(ElectricResistance), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricResistance)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -761,7 +760,7 @@ public ElectricResistance ToUnit(ElectricResistanceUnit unit, UnitConverter unit /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricResistanceUnit unitAsElectricResistanceUnit)) + if (!(unit is ElectricResistanceUnit unitAsElectricResistanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricResistanceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricResistanceUnit, DefaultConversionFunctions); @@ -770,7 +769,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricResistanceUnit unitAsElectricResistanceUnit)) + if (!(unit is ElectricResistanceUnit unitAsElectricResistanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricResistanceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricResistanceUnit, unitConverter); @@ -779,13 +778,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricResistance ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -960,15 +959,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricResistance)) + if (conversionType == typeof(ElectricResistance)) return this; - else if(conversionType == typeof(ElectricResistanceUnit)) + else if (conversionType == typeof(ElectricResistanceUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricResistance.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricResistance.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricResistance.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs index 9c33a36823..7a3565319b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -95,7 +95,7 @@ static ElectricResistivity() /// If value is NaN or Infinity. public ElectricResistivity(double value, ElectricResistivityUnit unit) { - if(unit == ElectricResistivityUnit.Undefined) + if (unit == ElectricResistivityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -112,7 +112,7 @@ public ElectricResistivity(double value, ElectricResistivityUnit unit) /// No unit was found for the given . public ElectricResistivity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -298,7 +298,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ElectricResistivityUnit.OhmMeter, ElectricResistivityUnit.OhmCentimeter, quantity => new ElectricResistivity(quantity.Value*100, ElectricResistivityUnit.OhmCentimeter)); unitConverter.SetConversionFunction(ElectricResistivityUnit.OhmMeter, ElectricResistivityUnit.PicoohmCentimeter, quantity => new ElectricResistivity((quantity.Value*100) / 1e-12d, ElectricResistivityUnit.PicoohmCentimeter)); unitConverter.SetConversionFunction(ElectricResistivityUnit.OhmMeter, ElectricResistivityUnit.PicoohmMeter, quantity => new ElectricResistivity((quantity.Value) / 1e-12d, ElectricResistivityUnit.PicoohmMeter)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricResistivityUnit.OhmMeter, ElectricResistivityUnit.OhmMeter, quantity => quantity); @@ -734,8 +733,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricResistivity objElectricResistivity)) throw new ArgumentException("Expected type ElectricResistivity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricResistivity objElectricResistivity)) throw new ArgumentException("Expected type ElectricResistivity.", nameof(obj)); return CompareTo(objElectricResistivity); } @@ -750,7 +749,7 @@ public int CompareTo(ElectricResistivity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricResistivity objElectricResistivity)) + if (obj is null || !(obj is ElectricResistivity objElectricResistivity)) return false; return Equals(objElectricResistivity); @@ -805,7 +804,7 @@ public bool Equals(ElectricResistivity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricResistivity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -833,7 +832,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricResistivityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -843,13 +842,13 @@ public double As(ElectricResistivityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -858,7 +857,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricResistivityUnit unitAsElectricResistivityUnit)) + if (!(unit is ElectricResistivityUnit unitAsElectricResistivityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricResistivityUnit)} is supported.", nameof(unit)); return As(unitAsElectricResistivityUnit); @@ -882,18 +881,18 @@ public ElectricResistivity ToUnit(ElectricResistivityUnit unit) /// A ElectricResistivity with the specified unit. public ElectricResistivity ToUnit(ElectricResistivityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricResistivity), Unit, typeof(ElectricResistivity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricResistivity), Unit, typeof(ElectricResistivity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricResistivity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -908,7 +907,7 @@ public ElectricResistivity ToUnit(ElectricResistivityUnit unit, UnitConverter un /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricResistivityUnit unitAsElectricResistivityUnit)) + if (!(unit is ElectricResistivityUnit unitAsElectricResistivityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricResistivityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricResistivityUnit, DefaultConversionFunctions); @@ -917,7 +916,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricResistivityUnit unitAsElectricResistivityUnit)) + if (!(unit is ElectricResistivityUnit unitAsElectricResistivityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricResistivityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricResistivityUnit, unitConverter); @@ -926,13 +925,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricResistivity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1107,15 +1106,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricResistivity)) + if (conversionType == typeof(ElectricResistivity)) return this; - else if(conversionType == typeof(ElectricResistivityUnit)) + else if (conversionType == typeof(ElectricResistivityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricResistivity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricResistivity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricResistivity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs index 5eae2ecd22..7f2cc9382f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs @@ -84,7 +84,7 @@ static ElectricSurfaceChargeDensity() /// If value is NaN or Infinity. public ElectricSurfaceChargeDensity(double value, ElectricSurfaceChargeDensityUnit unit) { - if(unit == ElectricSurfaceChargeDensityUnit.Undefined) + if (unit == ElectricSurfaceChargeDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -101,7 +101,7 @@ public ElectricSurfaceChargeDensity(double value, ElectricSurfaceChargeDensityUn /// No unit was found for the given . public ElectricSurfaceChargeDensity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -221,7 +221,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) // Register in unit converter: BaseUnit -> ElectricSurfaceChargeDensityUnit unitConverter.SetConversionFunction(ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter, ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter, quantity => new ElectricSurfaceChargeDensity(quantity.Value / 1.0e4, ElectricSurfaceChargeDensityUnit.CoulombPerSquareCentimeter)); unitConverter.SetConversionFunction(ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter, ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch, quantity => new ElectricSurfaceChargeDensity(quantity.Value / 1.5500031000062000e3, ElectricSurfaceChargeDensityUnit.CoulombPerSquareInch)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter, ElectricSurfaceChargeDensityUnit.CoulombPerSquareMeter, quantity => quantity); @@ -536,8 +535,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricSurfaceChargeDensity objElectricSurfaceChargeDensity)) throw new ArgumentException("Expected type ElectricSurfaceChargeDensity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ElectricSurfaceChargeDensity objElectricSurfaceChargeDensity)) throw new ArgumentException("Expected type ElectricSurfaceChargeDensity.", nameof(obj)); return CompareTo(objElectricSurfaceChargeDensity); } @@ -552,7 +551,7 @@ public int CompareTo(ElectricSurfaceChargeDensity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ElectricSurfaceChargeDensity objElectricSurfaceChargeDensity)) + if (obj is null || !(obj is ElectricSurfaceChargeDensity objElectricSurfaceChargeDensity)) return false; return Equals(objElectricSurfaceChargeDensity); @@ -607,7 +606,7 @@ public bool Equals(ElectricSurfaceChargeDensity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ElectricSurfaceChargeDensity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -635,7 +634,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ElectricSurfaceChargeDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -645,13 +644,13 @@ public double As(ElectricSurfaceChargeDensityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -660,7 +659,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ElectricSurfaceChargeDensityUnit unitAsElectricSurfaceChargeDensityUnit)) + if (!(unit is ElectricSurfaceChargeDensityUnit unitAsElectricSurfaceChargeDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricSurfaceChargeDensityUnit)} is supported.", nameof(unit)); return As(unitAsElectricSurfaceChargeDensityUnit); @@ -684,18 +683,18 @@ public ElectricSurfaceChargeDensity ToUnit(ElectricSurfaceChargeDensityUnit unit /// A ElectricSurfaceChargeDensity with the specified unit. public ElectricSurfaceChargeDensity ToUnit(ElectricSurfaceChargeDensityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ElectricSurfaceChargeDensity), Unit, typeof(ElectricSurfaceChargeDensity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ElectricSurfaceChargeDensity), Unit, typeof(ElectricSurfaceChargeDensity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ElectricSurfaceChargeDensity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -710,7 +709,7 @@ public ElectricSurfaceChargeDensity ToUnit(ElectricSurfaceChargeDensityUnit unit /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ElectricSurfaceChargeDensityUnit unitAsElectricSurfaceChargeDensityUnit)) + if (!(unit is ElectricSurfaceChargeDensityUnit unitAsElectricSurfaceChargeDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricSurfaceChargeDensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricSurfaceChargeDensityUnit, DefaultConversionFunctions); @@ -719,7 +718,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ElectricSurfaceChargeDensityUnit unitAsElectricSurfaceChargeDensityUnit)) + if (!(unit is ElectricSurfaceChargeDensityUnit unitAsElectricSurfaceChargeDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricSurfaceChargeDensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsElectricSurfaceChargeDensityUnit, unitConverter); @@ -728,13 +727,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ElectricSurfaceChargeDensity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -909,15 +908,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ElectricSurfaceChargeDensity)) + if (conversionType == typeof(ElectricSurfaceChargeDensity)) return this; - else if(conversionType == typeof(ElectricSurfaceChargeDensityUnit)) + else if (conversionType == typeof(ElectricSurfaceChargeDensityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ElectricSurfaceChargeDensity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ElectricSurfaceChargeDensity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ElectricSurfaceChargeDensity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ElectricSurfaceChargeDensity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs index f2627c23bc..e43449b90a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs @@ -114,7 +114,7 @@ static Energy() /// If value is NaN or Infinity. public Energy(double value, EnergyUnit unit) { - if(unit == EnergyUnit.Undefined) + if (unit == EnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -131,7 +131,7 @@ public Energy(double value, EnergyUnit unit) /// No unit was found for the given . public Energy(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -449,7 +449,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(EnergyUnit.Joule, EnergyUnit.ThermUs, quantity => new Energy(quantity.Value/1.054804e8, EnergyUnit.ThermUs)); unitConverter.SetConversionFunction(EnergyUnit.Joule, EnergyUnit.WattDay, quantity => new Energy(quantity.Value/(24*3600d), EnergyUnit.WattDay)); unitConverter.SetConversionFunction(EnergyUnit.Joule, EnergyUnit.WattHour, quantity => new Energy(quantity.Value/3600d, EnergyUnit.WattHour)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(EnergyUnit.Joule, EnergyUnit.Joule, quantity => quantity); @@ -1148,8 +1147,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Energ /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Energy objEnergy)) throw new ArgumentException("Expected type Energy.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Energy objEnergy)) throw new ArgumentException("Expected type Energy.", nameof(obj)); return CompareTo(objEnergy); } @@ -1164,7 +1163,7 @@ public int CompareTo(Energy other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Energy objEnergy)) + if (obj is null || !(obj is Energy objEnergy)) return false; return Equals(objEnergy); @@ -1219,7 +1218,7 @@ public bool Equals(Energy other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Energy other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1247,7 +1246,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(EnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1257,13 +1256,13 @@ public double As(EnergyUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1272,7 +1271,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is EnergyUnit unitAsEnergyUnit)) + if (!(unit is EnergyUnit unitAsEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(EnergyUnit)} is supported.", nameof(unit)); return As(unitAsEnergyUnit); @@ -1296,18 +1295,18 @@ public Energy ToUnit(EnergyUnit unit) /// A Energy with the specified unit. public Energy ToUnit(EnergyUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Energy), Unit, typeof(Energy), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Energy), Unit, typeof(Energy), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Energy)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1322,7 +1321,7 @@ public Energy ToUnit(EnergyUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is EnergyUnit unitAsEnergyUnit)) + if (!(unit is EnergyUnit unitAsEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(EnergyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsEnergyUnit, DefaultConversionFunctions); @@ -1331,7 +1330,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is EnergyUnit unitAsEnergyUnit)) + if (!(unit is EnergyUnit unitAsEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(EnergyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsEnergyUnit, unitConverter); @@ -1340,13 +1339,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Energy ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1521,15 +1520,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Energy)) + if (conversionType == typeof(Energy)) return this; - else if(conversionType == typeof(EnergyUnit)) + else if (conversionType == typeof(EnergyUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Energy.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Energy.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Energy.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Energy)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs index 52793b1d45..056a445345 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs @@ -85,7 +85,7 @@ static Entropy() /// If value is NaN or Infinity. public Entropy(double value, EntropyUnit unit) { - if(unit == EntropyUnit.Undefined) + if (unit == EntropyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -102,7 +102,7 @@ public Entropy(double value, EntropyUnit unit) /// No unit was found for the given . public Entropy(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -246,7 +246,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(EntropyUnit.JoulePerKelvin, EntropyUnit.KilojoulePerDegreeCelsius, quantity => new Entropy((quantity.Value) / 1e3d, EntropyUnit.KilojoulePerDegreeCelsius)); unitConverter.SetConversionFunction(EntropyUnit.JoulePerKelvin, EntropyUnit.KilojoulePerKelvin, quantity => new Entropy((quantity.Value) / 1e3d, EntropyUnit.KilojoulePerKelvin)); unitConverter.SetConversionFunction(EntropyUnit.JoulePerKelvin, EntropyUnit.MegajoulePerKelvin, quantity => new Entropy((quantity.Value) / 1e6d, EntropyUnit.MegajoulePerKelvin)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(EntropyUnit.JoulePerKelvin, EntropyUnit.JoulePerKelvin, quantity => quantity); @@ -605,8 +604,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Entro /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Entropy objEntropy)) throw new ArgumentException("Expected type Entropy.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Entropy objEntropy)) throw new ArgumentException("Expected type Entropy.", nameof(obj)); return CompareTo(objEntropy); } @@ -621,7 +620,7 @@ public int CompareTo(Entropy other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Entropy objEntropy)) + if (obj is null || !(obj is Entropy objEntropy)) return false; return Equals(objEntropy); @@ -676,7 +675,7 @@ public bool Equals(Entropy other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Entropy other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -704,7 +703,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(EntropyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -714,13 +713,13 @@ public double As(EntropyUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -729,7 +728,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is EntropyUnit unitAsEntropyUnit)) + if (!(unit is EntropyUnit unitAsEntropyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(EntropyUnit)} is supported.", nameof(unit)); return As(unitAsEntropyUnit); @@ -753,18 +752,18 @@ public Entropy ToUnit(EntropyUnit unit) /// A Entropy with the specified unit. public Entropy ToUnit(EntropyUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Entropy), Unit, typeof(Entropy), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Entropy), Unit, typeof(Entropy), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Entropy)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -779,7 +778,7 @@ public Entropy ToUnit(EntropyUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is EntropyUnit unitAsEntropyUnit)) + if (!(unit is EntropyUnit unitAsEntropyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(EntropyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsEntropyUnit, DefaultConversionFunctions); @@ -788,7 +787,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is EntropyUnit unitAsEntropyUnit)) + if (!(unit is EntropyUnit unitAsEntropyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(EntropyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsEntropyUnit, unitConverter); @@ -797,13 +796,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Entropy ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -978,15 +977,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Entropy)) + if (conversionType == typeof(Entropy)) return this; - else if(conversionType == typeof(EntropyUnit)) + else if (conversionType == typeof(EntropyUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Entropy.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Entropy.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Entropy.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Entropy)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Force.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.g.cs index 724b6d095e..bc42500860 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs @@ -93,7 +93,7 @@ static Force() /// If value is NaN or Infinity. public Force(double value, ForceUnit unit) { - if(unit == ForceUnit.Undefined) + if (unit == ForceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -110,7 +110,7 @@ public Force(double value, ForceUnit unit) /// No unit was found for the given . public Force(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -302,7 +302,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ForceUnit.Newton, ForceUnit.PoundForce, quantity => new Force(quantity.Value/4.4482216152605095551842641431421, ForceUnit.PoundForce)); unitConverter.SetConversionFunction(ForceUnit.Newton, ForceUnit.ShortTonForce, quantity => new Force(quantity.Value/8.896443230521e3, ForceUnit.ShortTonForce)); unitConverter.SetConversionFunction(ForceUnit.Newton, ForceUnit.TonneForce, quantity => new Force(quantity.Value/9.80665002864e3, ForceUnit.TonneForce)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ForceUnit.Newton, ForceUnit.Newton, quantity => quantity); @@ -762,8 +761,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Force /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Force objForce)) throw new ArgumentException("Expected type Force.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Force objForce)) throw new ArgumentException("Expected type Force.", nameof(obj)); return CompareTo(objForce); } @@ -778,7 +777,7 @@ public int CompareTo(Force other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Force objForce)) + if (obj is null || !(obj is Force objForce)) return false; return Equals(objForce); @@ -833,7 +832,7 @@ public bool Equals(Force other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Force other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -861,7 +860,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ForceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -871,13 +870,13 @@ public double As(ForceUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -886,7 +885,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ForceUnit unitAsForceUnit)) + if (!(unit is ForceUnit unitAsForceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForceUnit)} is supported.", nameof(unit)); return As(unitAsForceUnit); @@ -910,18 +909,18 @@ public Force ToUnit(ForceUnit unit) /// A Force with the specified unit. public Force ToUnit(ForceUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Force), Unit, typeof(Force), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Force), Unit, typeof(Force), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Force)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -936,7 +935,7 @@ public Force ToUnit(ForceUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ForceUnit unitAsForceUnit)) + if (!(unit is ForceUnit unitAsForceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsForceUnit, DefaultConversionFunctions); @@ -945,7 +944,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ForceUnit unitAsForceUnit)) + if (!(unit is ForceUnit unitAsForceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsForceUnit, unitConverter); @@ -954,13 +953,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Force ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1135,15 +1134,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Force)) + if (conversionType == typeof(Force)) return this; - else if(conversionType == typeof(ForceUnit)) + else if (conversionType == typeof(ForceUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Force.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Force.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Force.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Force)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs index 2520b646c8..29cf6f6613 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -93,7 +93,7 @@ static ForceChangeRate() /// If value is NaN or Infinity. public ForceChangeRate(double value, ForceChangeRateUnit unit) { - if(unit == ForceChangeRateUnit.Undefined) + if (unit == ForceChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -110,7 +110,7 @@ public ForceChangeRate(double value, ForceChangeRateUnit unit) /// No unit was found for the given . public ForceChangeRate(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -302,7 +302,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ForceChangeRateUnit.NewtonPerSecond, ForceChangeRateUnit.NewtonPerMinute, quantity => new ForceChangeRate(quantity.Value*60, ForceChangeRateUnit.NewtonPerMinute)); unitConverter.SetConversionFunction(ForceChangeRateUnit.NewtonPerSecond, ForceChangeRateUnit.PoundForcePerMinute, quantity => new ForceChangeRate(quantity.Value/4.4482216152605095551842641431421*60, ForceChangeRateUnit.PoundForcePerMinute)); unitConverter.SetConversionFunction(ForceChangeRateUnit.NewtonPerSecond, ForceChangeRateUnit.PoundForcePerSecond, quantity => new ForceChangeRate(quantity.Value/4.4482216152605095551842641431421, ForceChangeRateUnit.PoundForcePerSecond)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ForceChangeRateUnit.NewtonPerSecond, ForceChangeRateUnit.NewtonPerSecond, quantity => quantity); @@ -749,8 +748,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Force /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ForceChangeRate objForceChangeRate)) throw new ArgumentException("Expected type ForceChangeRate.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ForceChangeRate objForceChangeRate)) throw new ArgumentException("Expected type ForceChangeRate.", nameof(obj)); return CompareTo(objForceChangeRate); } @@ -765,7 +764,7 @@ public int CompareTo(ForceChangeRate other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ForceChangeRate objForceChangeRate)) + if (obj is null || !(obj is ForceChangeRate objForceChangeRate)) return false; return Equals(objForceChangeRate); @@ -820,7 +819,7 @@ public bool Equals(ForceChangeRate other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ForceChangeRate other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -848,7 +847,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ForceChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -858,13 +857,13 @@ public double As(ForceChangeRateUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -873,7 +872,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ForceChangeRateUnit unitAsForceChangeRateUnit)) + if (!(unit is ForceChangeRateUnit unitAsForceChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForceChangeRateUnit)} is supported.", nameof(unit)); return As(unitAsForceChangeRateUnit); @@ -897,18 +896,18 @@ public ForceChangeRate ToUnit(ForceChangeRateUnit unit) /// A ForceChangeRate with the specified unit. public ForceChangeRate ToUnit(ForceChangeRateUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ForceChangeRate), Unit, typeof(ForceChangeRate), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ForceChangeRate), Unit, typeof(ForceChangeRate), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ForceChangeRate)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -923,7 +922,7 @@ public ForceChangeRate ToUnit(ForceChangeRateUnit unit, UnitConverter unitConver /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ForceChangeRateUnit unitAsForceChangeRateUnit)) + if (!(unit is ForceChangeRateUnit unitAsForceChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForceChangeRateUnit)} is supported.", nameof(unit)); return ToUnit(unitAsForceChangeRateUnit, DefaultConversionFunctions); @@ -932,7 +931,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ForceChangeRateUnit unitAsForceChangeRateUnit)) + if (!(unit is ForceChangeRateUnit unitAsForceChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForceChangeRateUnit)} is supported.", nameof(unit)); return ToUnit(unitAsForceChangeRateUnit, unitConverter); @@ -941,13 +940,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ForceChangeRate ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1122,15 +1121,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ForceChangeRate)) + if (conversionType == typeof(ForceChangeRate)) return this; - else if(conversionType == typeof(ForceChangeRateUnit)) + else if (conversionType == typeof(ForceChangeRateUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ForceChangeRate.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ForceChangeRate.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ForceChangeRate.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs index 28c3cd46c1..30ae58f2dd 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -116,7 +116,7 @@ static ForcePerLength() /// If value is NaN or Infinity. public ForcePerLength(double value, ForcePerLengthUnit unit) { - if(unit == ForcePerLengthUnit.Undefined) + if (unit == ForcePerLengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -133,7 +133,7 @@ public ForcePerLength(double value, ForcePerLengthUnit unit) /// No unit was found for the given . public ForcePerLength(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -463,7 +463,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ForcePerLengthUnit.NewtonPerMeter, ForcePerLengthUnit.TonneForcePerCentimeter, quantity => new ForcePerLength(quantity.Value/9.80665002864e5, ForcePerLengthUnit.TonneForcePerCentimeter)); unitConverter.SetConversionFunction(ForcePerLengthUnit.NewtonPerMeter, ForcePerLengthUnit.TonneForcePerMeter, quantity => new ForcePerLength(quantity.Value/9.80665002864e3, ForcePerLengthUnit.TonneForcePerMeter)); unitConverter.SetConversionFunction(ForcePerLengthUnit.NewtonPerMeter, ForcePerLengthUnit.TonneForcePerMillimeter, quantity => new ForcePerLength(quantity.Value/9.80665002864e6, ForcePerLengthUnit.TonneForcePerMillimeter)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ForcePerLengthUnit.NewtonPerMeter, ForcePerLengthUnit.NewtonPerMeter, quantity => quantity); @@ -1169,8 +1168,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Force /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ForcePerLength objForcePerLength)) throw new ArgumentException("Expected type ForcePerLength.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ForcePerLength objForcePerLength)) throw new ArgumentException("Expected type ForcePerLength.", nameof(obj)); return CompareTo(objForcePerLength); } @@ -1185,7 +1184,7 @@ public int CompareTo(ForcePerLength other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ForcePerLength objForcePerLength)) + if (obj is null || !(obj is ForcePerLength objForcePerLength)) return false; return Equals(objForcePerLength); @@ -1240,7 +1239,7 @@ public bool Equals(ForcePerLength other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ForcePerLength other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1268,7 +1267,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ForcePerLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1278,13 +1277,13 @@ public double As(ForcePerLengthUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1293,7 +1292,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ForcePerLengthUnit unitAsForcePerLengthUnit)) + if (!(unit is ForcePerLengthUnit unitAsForcePerLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForcePerLengthUnit)} is supported.", nameof(unit)); return As(unitAsForcePerLengthUnit); @@ -1317,18 +1316,18 @@ public ForcePerLength ToUnit(ForcePerLengthUnit unit) /// A ForcePerLength with the specified unit. public ForcePerLength ToUnit(ForcePerLengthUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ForcePerLength), Unit, typeof(ForcePerLength), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ForcePerLength), Unit, typeof(ForcePerLength), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ForcePerLength)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1343,7 +1342,7 @@ public ForcePerLength ToUnit(ForcePerLengthUnit unit, UnitConverter unitConverte /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ForcePerLengthUnit unitAsForcePerLengthUnit)) + if (!(unit is ForcePerLengthUnit unitAsForcePerLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForcePerLengthUnit)} is supported.", nameof(unit)); return ToUnit(unitAsForcePerLengthUnit, DefaultConversionFunctions); @@ -1352,7 +1351,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ForcePerLengthUnit unitAsForcePerLengthUnit)) + if (!(unit is ForcePerLengthUnit unitAsForcePerLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForcePerLengthUnit)} is supported.", nameof(unit)); return ToUnit(unitAsForcePerLengthUnit, unitConverter); @@ -1361,13 +1360,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ForcePerLength ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1542,15 +1541,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ForcePerLength)) + if (conversionType == typeof(ForcePerLength)) return this; - else if(conversionType == typeof(ForcePerLengthUnit)) + else if (conversionType == typeof(ForcePerLengthUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ForcePerLength.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ForcePerLength.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ForcePerLength.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs index abe4cdec9c..7cdddf1b39 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs @@ -89,7 +89,7 @@ static Frequency() /// If value is NaN or Infinity. public Frequency(double value, FrequencyUnit unit) { - if(unit == FrequencyUnit.Undefined) + if (unit == FrequencyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -106,7 +106,7 @@ public Frequency(double value, FrequencyUnit unit) /// No unit was found for the given . public Frequency(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -274,7 +274,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(FrequencyUnit.Hertz, FrequencyUnit.PerSecond, quantity => new Frequency(quantity.Value, FrequencyUnit.PerSecond)); unitConverter.SetConversionFunction(FrequencyUnit.Hertz, FrequencyUnit.RadianPerSecond, quantity => new Frequency(quantity.Value*6.2831853072, FrequencyUnit.RadianPerSecond)); unitConverter.SetConversionFunction(FrequencyUnit.Hertz, FrequencyUnit.Terahertz, quantity => new Frequency((quantity.Value) / 1e12d, FrequencyUnit.Terahertz)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(FrequencyUnit.Hertz, FrequencyUnit.Hertz, quantity => quantity); @@ -684,8 +683,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Frequ /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Frequency objFrequency)) throw new ArgumentException("Expected type Frequency.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Frequency objFrequency)) throw new ArgumentException("Expected type Frequency.", nameof(obj)); return CompareTo(objFrequency); } @@ -700,7 +699,7 @@ public int CompareTo(Frequency other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Frequency objFrequency)) + if (obj is null || !(obj is Frequency objFrequency)) return false; return Equals(objFrequency); @@ -755,7 +754,7 @@ public bool Equals(Frequency other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Frequency other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -783,7 +782,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(FrequencyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -793,13 +792,13 @@ public double As(FrequencyUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -808,7 +807,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is FrequencyUnit unitAsFrequencyUnit)) + if (!(unit is FrequencyUnit unitAsFrequencyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(FrequencyUnit)} is supported.", nameof(unit)); return As(unitAsFrequencyUnit); @@ -832,18 +831,18 @@ public Frequency ToUnit(FrequencyUnit unit) /// A Frequency with the specified unit. public Frequency ToUnit(FrequencyUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Frequency), Unit, typeof(Frequency), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Frequency), Unit, typeof(Frequency), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Frequency)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -858,7 +857,7 @@ public Frequency ToUnit(FrequencyUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is FrequencyUnit unitAsFrequencyUnit)) + if (!(unit is FrequencyUnit unitAsFrequencyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(FrequencyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsFrequencyUnit, DefaultConversionFunctions); @@ -867,7 +866,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is FrequencyUnit unitAsFrequencyUnit)) + if (!(unit is FrequencyUnit unitAsFrequencyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(FrequencyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsFrequencyUnit, unitConverter); @@ -876,13 +875,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Frequency ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1057,15 +1056,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Frequency)) + if (conversionType == typeof(Frequency)) return this; - else if(conversionType == typeof(FrequencyUnit)) + else if (conversionType == typeof(FrequencyUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Frequency.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Frequency.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Frequency.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Frequency)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs index ab765b17fb..9a9014be43 100644 --- a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs @@ -85,7 +85,7 @@ static FuelEfficiency() /// If value is NaN or Infinity. public FuelEfficiency(double value, FuelEfficiencyUnit unit) { - if(unit == FuelEfficiencyUnit.Undefined) + if (unit == FuelEfficiencyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -102,7 +102,7 @@ public FuelEfficiency(double value, FuelEfficiencyUnit unit) /// No unit was found for the given . public FuelEfficiency(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -228,7 +228,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(FuelEfficiencyUnit.LiterPer100Kilometers, FuelEfficiencyUnit.KilometerPerLiter, quantity => new FuelEfficiency(100/quantity.Value, FuelEfficiencyUnit.KilometerPerLiter)); unitConverter.SetConversionFunction(FuelEfficiencyUnit.LiterPer100Kilometers, FuelEfficiencyUnit.MilePerUkGallon, quantity => new FuelEfficiency((100*4.54609188)/(1.609344*quantity.Value), FuelEfficiencyUnit.MilePerUkGallon)); unitConverter.SetConversionFunction(FuelEfficiencyUnit.LiterPer100Kilometers, FuelEfficiencyUnit.MilePerUsGallon, quantity => new FuelEfficiency((100*3.785411784)/(1.609344*quantity.Value), FuelEfficiencyUnit.MilePerUsGallon)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(FuelEfficiencyUnit.LiterPer100Kilometers, FuelEfficiencyUnit.LiterPer100Kilometers, quantity => quantity); @@ -554,8 +553,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out FuelE /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is FuelEfficiency objFuelEfficiency)) throw new ArgumentException("Expected type FuelEfficiency.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is FuelEfficiency objFuelEfficiency)) throw new ArgumentException("Expected type FuelEfficiency.", nameof(obj)); return CompareTo(objFuelEfficiency); } @@ -570,7 +569,7 @@ public int CompareTo(FuelEfficiency other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is FuelEfficiency objFuelEfficiency)) + if (obj is null || !(obj is FuelEfficiency objFuelEfficiency)) return false; return Equals(objFuelEfficiency); @@ -625,7 +624,7 @@ public bool Equals(FuelEfficiency other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(FuelEfficiency other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -653,7 +652,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(FuelEfficiencyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -663,13 +662,13 @@ public double As(FuelEfficiencyUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -678,7 +677,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is FuelEfficiencyUnit unitAsFuelEfficiencyUnit)) + if (!(unit is FuelEfficiencyUnit unitAsFuelEfficiencyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(FuelEfficiencyUnit)} is supported.", nameof(unit)); return As(unitAsFuelEfficiencyUnit); @@ -702,18 +701,18 @@ public FuelEfficiency ToUnit(FuelEfficiencyUnit unit) /// A FuelEfficiency with the specified unit. public FuelEfficiency ToUnit(FuelEfficiencyUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(FuelEfficiency), Unit, typeof(FuelEfficiency), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(FuelEfficiency), Unit, typeof(FuelEfficiency), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (FuelEfficiency)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -728,7 +727,7 @@ public FuelEfficiency ToUnit(FuelEfficiencyUnit unit, UnitConverter unitConverte /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is FuelEfficiencyUnit unitAsFuelEfficiencyUnit)) + if (!(unit is FuelEfficiencyUnit unitAsFuelEfficiencyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(FuelEfficiencyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsFuelEfficiencyUnit, DefaultConversionFunctions); @@ -737,7 +736,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is FuelEfficiencyUnit unitAsFuelEfficiencyUnit)) + if (!(unit is FuelEfficiencyUnit unitAsFuelEfficiencyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(FuelEfficiencyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsFuelEfficiencyUnit, unitConverter); @@ -746,13 +745,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public FuelEfficiency ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -927,15 +926,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(FuelEfficiency)) + if (conversionType == typeof(FuelEfficiency)) return this; - else if(conversionType == typeof(FuelEfficiencyUnit)) + else if (conversionType == typeof(FuelEfficiencyUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return FuelEfficiency.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return FuelEfficiency.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return FuelEfficiency.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(FuelEfficiency)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs index 10b6bbe801..c43ac94b2b 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs @@ -96,7 +96,7 @@ static HeatFlux() /// If value is NaN or Infinity. public HeatFlux(double value, HeatFluxUnit unit) { - if(unit == HeatFluxUnit.Undefined) + if (unit == HeatFluxUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -113,7 +113,7 @@ public HeatFlux(double value, HeatFluxUnit unit) /// No unit was found for the given . public HeatFlux(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -323,7 +323,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(HeatFluxUnit.WattPerSquareMeter, HeatFluxUnit.PoundPerSecondCubed, quantity => new HeatFlux(quantity.Value/4.5359237e-1, HeatFluxUnit.PoundPerSecondCubed)); unitConverter.SetConversionFunction(HeatFluxUnit.WattPerSquareMeter, HeatFluxUnit.WattPerSquareFoot, quantity => new HeatFlux(quantity.Value/1.07639e1, HeatFluxUnit.WattPerSquareFoot)); unitConverter.SetConversionFunction(HeatFluxUnit.WattPerSquareMeter, HeatFluxUnit.WattPerSquareInch, quantity => new HeatFlux(quantity.Value/1.5500031e3, HeatFluxUnit.WattPerSquareInch)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(HeatFluxUnit.WattPerSquareMeter, HeatFluxUnit.WattPerSquareMeter, quantity => quantity); @@ -803,8 +802,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out HeatF /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is HeatFlux objHeatFlux)) throw new ArgumentException("Expected type HeatFlux.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is HeatFlux objHeatFlux)) throw new ArgumentException("Expected type HeatFlux.", nameof(obj)); return CompareTo(objHeatFlux); } @@ -819,7 +818,7 @@ public int CompareTo(HeatFlux other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is HeatFlux objHeatFlux)) + if (obj is null || !(obj is HeatFlux objHeatFlux)) return false; return Equals(objHeatFlux); @@ -874,7 +873,7 @@ public bool Equals(HeatFlux other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(HeatFlux other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -902,7 +901,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(HeatFluxUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -912,13 +911,13 @@ public double As(HeatFluxUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -927,7 +926,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is HeatFluxUnit unitAsHeatFluxUnit)) + if (!(unit is HeatFluxUnit unitAsHeatFluxUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(HeatFluxUnit)} is supported.", nameof(unit)); return As(unitAsHeatFluxUnit); @@ -951,18 +950,18 @@ public HeatFlux ToUnit(HeatFluxUnit unit) /// A HeatFlux with the specified unit. public HeatFlux ToUnit(HeatFluxUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(HeatFlux), Unit, typeof(HeatFlux), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(HeatFlux), Unit, typeof(HeatFlux), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (HeatFlux)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -977,7 +976,7 @@ public HeatFlux ToUnit(HeatFluxUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is HeatFluxUnit unitAsHeatFluxUnit)) + if (!(unit is HeatFluxUnit unitAsHeatFluxUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(HeatFluxUnit)} is supported.", nameof(unit)); return ToUnit(unitAsHeatFluxUnit, DefaultConversionFunctions); @@ -986,7 +985,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is HeatFluxUnit unitAsHeatFluxUnit)) + if (!(unit is HeatFluxUnit unitAsHeatFluxUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(HeatFluxUnit)} is supported.", nameof(unit)); return ToUnit(unitAsHeatFluxUnit, unitConverter); @@ -995,13 +994,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public HeatFlux ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1176,15 +1175,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(HeatFlux)) + if (conversionType == typeof(HeatFlux)) return this; - else if(conversionType == typeof(HeatFluxUnit)) + else if (conversionType == typeof(HeatFluxUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return HeatFlux.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return HeatFlux.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return HeatFlux.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(HeatFlux)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs index a1f1b2ad80..c0b98f2e13 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs @@ -81,7 +81,7 @@ static HeatTransferCoefficient() /// If value is NaN or Infinity. public HeatTransferCoefficient(double value, HeatTransferCoefficientUnit unit) { - if(unit == HeatTransferCoefficientUnit.Undefined) + if (unit == HeatTransferCoefficientUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -98,7 +98,7 @@ public HeatTransferCoefficient(double value, HeatTransferCoefficientUnit unit) /// No unit was found for the given . public HeatTransferCoefficient(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -218,7 +218,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) // Register in unit converter: BaseUnit -> HeatTransferCoefficientUnit unitConverter.SetConversionFunction(HeatTransferCoefficientUnit.WattPerSquareMeterKelvin, HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit, quantity => new HeatTransferCoefficient(quantity.Value / 5.6782633411134878, HeatTransferCoefficientUnit.BtuPerSquareFootDegreeFahrenheit)); unitConverter.SetConversionFunction(HeatTransferCoefficientUnit.WattPerSquareMeterKelvin, HeatTransferCoefficientUnit.WattPerSquareMeterCelsius, quantity => new HeatTransferCoefficient(quantity.Value, HeatTransferCoefficientUnit.WattPerSquareMeterCelsius)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(HeatTransferCoefficientUnit.WattPerSquareMeterKelvin, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin, quantity => quantity); @@ -533,8 +532,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out HeatT /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is HeatTransferCoefficient objHeatTransferCoefficient)) throw new ArgumentException("Expected type HeatTransferCoefficient.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is HeatTransferCoefficient objHeatTransferCoefficient)) throw new ArgumentException("Expected type HeatTransferCoefficient.", nameof(obj)); return CompareTo(objHeatTransferCoefficient); } @@ -549,7 +548,7 @@ public int CompareTo(HeatTransferCoefficient other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is HeatTransferCoefficient objHeatTransferCoefficient)) + if (obj is null || !(obj is HeatTransferCoefficient objHeatTransferCoefficient)) return false; return Equals(objHeatTransferCoefficient); @@ -604,7 +603,7 @@ public bool Equals(HeatTransferCoefficient other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(HeatTransferCoefficient other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -632,7 +631,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(HeatTransferCoefficientUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -642,13 +641,13 @@ public double As(HeatTransferCoefficientUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -657,7 +656,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is HeatTransferCoefficientUnit unitAsHeatTransferCoefficientUnit)) + if (!(unit is HeatTransferCoefficientUnit unitAsHeatTransferCoefficientUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(HeatTransferCoefficientUnit)} is supported.", nameof(unit)); return As(unitAsHeatTransferCoefficientUnit); @@ -681,18 +680,18 @@ public HeatTransferCoefficient ToUnit(HeatTransferCoefficientUnit unit) /// A HeatTransferCoefficient with the specified unit. public HeatTransferCoefficient ToUnit(HeatTransferCoefficientUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(HeatTransferCoefficient), Unit, typeof(HeatTransferCoefficient), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(HeatTransferCoefficient), Unit, typeof(HeatTransferCoefficient), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (HeatTransferCoefficient)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -707,7 +706,7 @@ public HeatTransferCoefficient ToUnit(HeatTransferCoefficientUnit unit, UnitConv /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is HeatTransferCoefficientUnit unitAsHeatTransferCoefficientUnit)) + if (!(unit is HeatTransferCoefficientUnit unitAsHeatTransferCoefficientUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(HeatTransferCoefficientUnit)} is supported.", nameof(unit)); return ToUnit(unitAsHeatTransferCoefficientUnit, DefaultConversionFunctions); @@ -716,7 +715,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is HeatTransferCoefficientUnit unitAsHeatTransferCoefficientUnit)) + if (!(unit is HeatTransferCoefficientUnit unitAsHeatTransferCoefficientUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(HeatTransferCoefficientUnit)} is supported.", nameof(unit)); return ToUnit(unitAsHeatTransferCoefficientUnit, unitConverter); @@ -725,13 +724,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public HeatTransferCoefficient ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -906,15 +905,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(HeatTransferCoefficient)) + if (conversionType == typeof(HeatTransferCoefficient)) return this; - else if(conversionType == typeof(HeatTransferCoefficientUnit)) + else if (conversionType == typeof(HeatTransferCoefficientUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return HeatTransferCoefficient.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return HeatTransferCoefficient.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return HeatTransferCoefficient.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs index d1050cdfe3..f2163f2c19 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs @@ -85,7 +85,7 @@ static Illuminance() /// If value is NaN or Infinity. public Illuminance(double value, IlluminanceUnit unit) { - if(unit == IlluminanceUnit.Undefined) + if (unit == IlluminanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -102,7 +102,7 @@ public Illuminance(double value, IlluminanceUnit unit) /// No unit was found for the given . public Illuminance(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -228,7 +228,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(IlluminanceUnit.Lux, IlluminanceUnit.Kilolux, quantity => new Illuminance((quantity.Value) / 1e3d, IlluminanceUnit.Kilolux)); unitConverter.SetConversionFunction(IlluminanceUnit.Lux, IlluminanceUnit.Megalux, quantity => new Illuminance((quantity.Value) / 1e6d, IlluminanceUnit.Megalux)); unitConverter.SetConversionFunction(IlluminanceUnit.Lux, IlluminanceUnit.Millilux, quantity => new Illuminance((quantity.Value) / 1e-3d, IlluminanceUnit.Millilux)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(IlluminanceUnit.Lux, IlluminanceUnit.Lux, quantity => quantity); @@ -554,8 +553,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Illum /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Illuminance objIlluminance)) throw new ArgumentException("Expected type Illuminance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Illuminance objIlluminance)) throw new ArgumentException("Expected type Illuminance.", nameof(obj)); return CompareTo(objIlluminance); } @@ -570,7 +569,7 @@ public int CompareTo(Illuminance other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Illuminance objIlluminance)) + if (obj is null || !(obj is Illuminance objIlluminance)) return false; return Equals(objIlluminance); @@ -625,7 +624,7 @@ public bool Equals(Illuminance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Illuminance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -653,7 +652,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(IlluminanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -663,13 +662,13 @@ public double As(IlluminanceUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -678,7 +677,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is IlluminanceUnit unitAsIlluminanceUnit)) + if (!(unit is IlluminanceUnit unitAsIlluminanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IlluminanceUnit)} is supported.", nameof(unit)); return As(unitAsIlluminanceUnit); @@ -702,18 +701,18 @@ public Illuminance ToUnit(IlluminanceUnit unit) /// A Illuminance with the specified unit. public Illuminance ToUnit(IlluminanceUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Illuminance), Unit, typeof(Illuminance), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Illuminance), Unit, typeof(Illuminance), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Illuminance)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -728,7 +727,7 @@ public Illuminance ToUnit(IlluminanceUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is IlluminanceUnit unitAsIlluminanceUnit)) + if (!(unit is IlluminanceUnit unitAsIlluminanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IlluminanceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsIlluminanceUnit, DefaultConversionFunctions); @@ -737,7 +736,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is IlluminanceUnit unitAsIlluminanceUnit)) + if (!(unit is IlluminanceUnit unitAsIlluminanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IlluminanceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsIlluminanceUnit, unitConverter); @@ -746,13 +745,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Illuminance ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -927,15 +926,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Illuminance)) + if (conversionType == typeof(Illuminance)) return this; - else if(conversionType == typeof(IlluminanceUnit)) + else if (conversionType == typeof(IlluminanceUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Illuminance.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Illuminance.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Illuminance.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Illuminance)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Information.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.g.cs index 3b0e531058..247b33a76a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.g.cs @@ -104,7 +104,7 @@ static Information() /// If value is NaN or Infinity. public Information(decimal value, InformationUnit unit) { - if(unit == InformationUnit.Undefined) + if (unit == InformationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = value; @@ -121,7 +121,7 @@ public Information(decimal value, InformationUnit unit) /// No unit was found for the given . public Information(decimal value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -384,7 +384,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(InformationUnit.Bit, InformationUnit.Tebibyte, quantity => new Information((quantity.Value/8m) / (1024m * 1024 * 1024 * 1024), InformationUnit.Tebibyte)); unitConverter.SetConversionFunction(InformationUnit.Bit, InformationUnit.Terabit, quantity => new Information((quantity.Value) / 1e12m, InformationUnit.Terabit)); unitConverter.SetConversionFunction(InformationUnit.Bit, InformationUnit.Terabyte, quantity => new Information((quantity.Value/8m) / 1e12m, InformationUnit.Terabyte)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(InformationUnit.Bit, InformationUnit.Bit, quantity => quantity); @@ -952,8 +951,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Infor /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Information objInformation)) throw new ArgumentException("Expected type Information.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Information objInformation)) throw new ArgumentException("Expected type Information.", nameof(obj)); return CompareTo(objInformation); } @@ -968,7 +967,7 @@ public int CompareTo(Information other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Information objInformation)) + if (obj is null || !(obj is Information objInformation)) return false; return Equals(objInformation); @@ -1023,7 +1022,7 @@ public bool Equals(Information other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Information other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1051,7 +1050,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(InformationUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1061,13 +1060,13 @@ public double As(InformationUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1076,7 +1075,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is InformationUnit unitAsInformationUnit)) + if (!(unit is InformationUnit unitAsInformationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(InformationUnit)} is supported.", nameof(unit)); return As(unitAsInformationUnit); @@ -1100,18 +1099,18 @@ public Information ToUnit(InformationUnit unit) /// A Information with the specified unit. public Information ToUnit(InformationUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Information), Unit, typeof(Information), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Information), Unit, typeof(Information), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Information)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1126,7 +1125,7 @@ public Information ToUnit(InformationUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is InformationUnit unitAsInformationUnit)) + if (!(unit is InformationUnit unitAsInformationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(InformationUnit)} is supported.", nameof(unit)); return ToUnit(unitAsInformationUnit, DefaultConversionFunctions); @@ -1135,7 +1134,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is InformationUnit unitAsInformationUnit)) + if (!(unit is InformationUnit unitAsInformationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(InformationUnit)} is supported.", nameof(unit)); return ToUnit(unitAsInformationUnit, unitConverter); @@ -1144,13 +1143,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Information ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1325,15 +1324,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Information)) + if (conversionType == typeof(Information)) return this; - else if(conversionType == typeof(InformationUnit)) + else if (conversionType == typeof(InformationUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Information.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Information.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Information.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Information)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs index c9d596e469..a2eddac45e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs @@ -92,7 +92,7 @@ static Irradiance() /// If value is NaN or Infinity. public Irradiance(double value, IrradianceUnit unit) { - if(unit == IrradianceUnit.Undefined) + if (unit == IrradianceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -109,7 +109,7 @@ public Irradiance(double value, IrradianceUnit unit) /// No unit was found for the given . public Irradiance(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -295,7 +295,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(IrradianceUnit.WattPerSquareMeter, IrradianceUnit.PicowattPerSquareCentimeter, quantity => new Irradiance((quantity.Value*0.0001) / 1e-12d, IrradianceUnit.PicowattPerSquareCentimeter)); unitConverter.SetConversionFunction(IrradianceUnit.WattPerSquareMeter, IrradianceUnit.PicowattPerSquareMeter, quantity => new Irradiance((quantity.Value) / 1e-12d, IrradianceUnit.PicowattPerSquareMeter)); unitConverter.SetConversionFunction(IrradianceUnit.WattPerSquareMeter, IrradianceUnit.WattPerSquareCentimeter, quantity => new Irradiance(quantity.Value*0.0001, IrradianceUnit.WattPerSquareCentimeter)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(IrradianceUnit.WattPerSquareMeter, IrradianceUnit.WattPerSquareMeter, quantity => quantity); @@ -731,8 +730,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Irrad /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Irradiance objIrradiance)) throw new ArgumentException("Expected type Irradiance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Irradiance objIrradiance)) throw new ArgumentException("Expected type Irradiance.", nameof(obj)); return CompareTo(objIrradiance); } @@ -747,7 +746,7 @@ public int CompareTo(Irradiance other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Irradiance objIrradiance)) + if (obj is null || !(obj is Irradiance objIrradiance)) return false; return Equals(objIrradiance); @@ -802,7 +801,7 @@ public bool Equals(Irradiance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Irradiance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -830,7 +829,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(IrradianceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -840,13 +839,13 @@ public double As(IrradianceUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -855,7 +854,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is IrradianceUnit unitAsIrradianceUnit)) + if (!(unit is IrradianceUnit unitAsIrradianceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IrradianceUnit)} is supported.", nameof(unit)); return As(unitAsIrradianceUnit); @@ -879,18 +878,18 @@ public Irradiance ToUnit(IrradianceUnit unit) /// A Irradiance with the specified unit. public Irradiance ToUnit(IrradianceUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Irradiance), Unit, typeof(Irradiance), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Irradiance), Unit, typeof(Irradiance), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Irradiance)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -905,7 +904,7 @@ public Irradiance ToUnit(IrradianceUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is IrradianceUnit unitAsIrradianceUnit)) + if (!(unit is IrradianceUnit unitAsIrradianceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IrradianceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsIrradianceUnit, DefaultConversionFunctions); @@ -914,7 +913,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is IrradianceUnit unitAsIrradianceUnit)) + if (!(unit is IrradianceUnit unitAsIrradianceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IrradianceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsIrradianceUnit, unitConverter); @@ -923,13 +922,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Irradiance ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1104,15 +1103,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Irradiance)) + if (conversionType == typeof(Irradiance)) return this; - else if(conversionType == typeof(IrradianceUnit)) + else if (conversionType == typeof(IrradianceUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Irradiance.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Irradiance.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Irradiance.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Irradiance)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs index 3d94bf5605..9f7709ee3b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs @@ -88,7 +88,7 @@ static Irradiation() /// If value is NaN or Infinity. public Irradiation(double value, IrradiationUnit unit) { - if(unit == IrradiationUnit.Undefined) + if (unit == IrradiationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -105,7 +105,7 @@ public Irradiation(double value, IrradiationUnit unit) /// No unit was found for the given . public Irradiation(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -249,7 +249,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(IrradiationUnit.JoulePerSquareMeter, IrradiationUnit.KilowattHourPerSquareMeter, quantity => new Irradiation((quantity.Value/3600d) / 1e3d, IrradiationUnit.KilowattHourPerSquareMeter)); unitConverter.SetConversionFunction(IrradiationUnit.JoulePerSquareMeter, IrradiationUnit.MillijoulePerSquareCentimeter, quantity => new Irradiation((quantity.Value/1e4) / 1e-3d, IrradiationUnit.MillijoulePerSquareCentimeter)); unitConverter.SetConversionFunction(IrradiationUnit.JoulePerSquareMeter, IrradiationUnit.WattHourPerSquareMeter, quantity => new Irradiation(quantity.Value/3600d, IrradiationUnit.WattHourPerSquareMeter)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(IrradiationUnit.JoulePerSquareMeter, IrradiationUnit.JoulePerSquareMeter, quantity => quantity); @@ -608,8 +607,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Irrad /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Irradiation objIrradiation)) throw new ArgumentException("Expected type Irradiation.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Irradiation objIrradiation)) throw new ArgumentException("Expected type Irradiation.", nameof(obj)); return CompareTo(objIrradiation); } @@ -624,7 +623,7 @@ public int CompareTo(Irradiation other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Irradiation objIrradiation)) + if (obj is null || !(obj is Irradiation objIrradiation)) return false; return Equals(objIrradiation); @@ -679,7 +678,7 @@ public bool Equals(Irradiation other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Irradiation other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -707,7 +706,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(IrradiationUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -717,13 +716,13 @@ public double As(IrradiationUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -732,7 +731,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is IrradiationUnit unitAsIrradiationUnit)) + if (!(unit is IrradiationUnit unitAsIrradiationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IrradiationUnit)} is supported.", nameof(unit)); return As(unitAsIrradiationUnit); @@ -756,18 +755,18 @@ public Irradiation ToUnit(IrradiationUnit unit) /// A Irradiation with the specified unit. public Irradiation ToUnit(IrradiationUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Irradiation), Unit, typeof(Irradiation), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Irradiation), Unit, typeof(Irradiation), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Irradiation)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -782,7 +781,7 @@ public Irradiation ToUnit(IrradiationUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is IrradiationUnit unitAsIrradiationUnit)) + if (!(unit is IrradiationUnit unitAsIrradiationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IrradiationUnit)} is supported.", nameof(unit)); return ToUnit(unitAsIrradiationUnit, DefaultConversionFunctions); @@ -791,7 +790,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is IrradiationUnit unitAsIrradiationUnit)) + if (!(unit is IrradiationUnit unitAsIrradiationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IrradiationUnit)} is supported.", nameof(unit)); return ToUnit(unitAsIrradiationUnit, unitConverter); @@ -800,13 +799,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Irradiation ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -981,15 +980,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Irradiation)) + if (conversionType == typeof(Irradiation)) return this; - else if(conversionType == typeof(IrradiationUnit)) + else if (conversionType == typeof(IrradiationUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Irradiation.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Irradiation.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Irradiation.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Irradiation)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs index 931fcc23c0..360a9563ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -90,7 +90,7 @@ static KinematicViscosity() /// If value is NaN or Infinity. public KinematicViscosity(double value, KinematicViscosityUnit unit) { - if(unit == KinematicViscosityUnit.Undefined) + if (unit == KinematicViscosityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -107,7 +107,7 @@ public KinematicViscosity(double value, KinematicViscosityUnit unit) /// No unit was found for the given . public KinematicViscosity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -263,7 +263,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(KinematicViscosityUnit.SquareMeterPerSecond, KinematicViscosityUnit.Nanostokes, quantity => new KinematicViscosity((quantity.Value*1e4) / 1e-9d, KinematicViscosityUnit.Nanostokes)); unitConverter.SetConversionFunction(KinematicViscosityUnit.SquareMeterPerSecond, KinematicViscosityUnit.SquareFootPerSecond, quantity => new KinematicViscosity(quantity.Value*10.7639, KinematicViscosityUnit.SquareFootPerSecond)); unitConverter.SetConversionFunction(KinematicViscosityUnit.SquareMeterPerSecond, KinematicViscosityUnit.Stokes, quantity => new KinematicViscosity(quantity.Value*1e4, KinematicViscosityUnit.Stokes)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(KinematicViscosityUnit.SquareMeterPerSecond, KinematicViscosityUnit.SquareMeterPerSecond, quantity => quantity); @@ -652,8 +651,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Kinem /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is KinematicViscosity objKinematicViscosity)) throw new ArgumentException("Expected type KinematicViscosity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is KinematicViscosity objKinematicViscosity)) throw new ArgumentException("Expected type KinematicViscosity.", nameof(obj)); return CompareTo(objKinematicViscosity); } @@ -668,7 +667,7 @@ public int CompareTo(KinematicViscosity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is KinematicViscosity objKinematicViscosity)) + if (obj is null || !(obj is KinematicViscosity objKinematicViscosity)) return false; return Equals(objKinematicViscosity); @@ -723,7 +722,7 @@ public bool Equals(KinematicViscosity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(KinematicViscosity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -751,7 +750,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(KinematicViscosityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -761,13 +760,13 @@ public double As(KinematicViscosityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -776,7 +775,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is KinematicViscosityUnit unitAsKinematicViscosityUnit)) + if (!(unit is KinematicViscosityUnit unitAsKinematicViscosityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(KinematicViscosityUnit)} is supported.", nameof(unit)); return As(unitAsKinematicViscosityUnit); @@ -800,18 +799,18 @@ public KinematicViscosity ToUnit(KinematicViscosityUnit unit) /// A KinematicViscosity with the specified unit. public KinematicViscosity ToUnit(KinematicViscosityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(KinematicViscosity), Unit, typeof(KinematicViscosity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(KinematicViscosity), Unit, typeof(KinematicViscosity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (KinematicViscosity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -826,7 +825,7 @@ public KinematicViscosity ToUnit(KinematicViscosityUnit unit, UnitConverter unit /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is KinematicViscosityUnit unitAsKinematicViscosityUnit)) + if (!(unit is KinematicViscosityUnit unitAsKinematicViscosityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(KinematicViscosityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsKinematicViscosityUnit, DefaultConversionFunctions); @@ -835,7 +834,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is KinematicViscosityUnit unitAsKinematicViscosityUnit)) + if (!(unit is KinematicViscosityUnit unitAsKinematicViscosityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(KinematicViscosityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsKinematicViscosityUnit, unitConverter); @@ -844,13 +843,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public KinematicViscosity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1025,15 +1024,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(KinematicViscosity)) + if (conversionType == typeof(KinematicViscosity)) return this; - else if(conversionType == typeof(KinematicViscosityUnit)) + else if (conversionType == typeof(KinematicViscosityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return KinematicViscosity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return KinematicViscosity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return KinematicViscosity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs index d4bf05218f..ce28ea1195 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs @@ -80,7 +80,7 @@ static LapseRate() /// If value is NaN or Infinity. public LapseRate(double value, LapseRateUnit unit) { - if(unit == LapseRateUnit.Undefined) + if (unit == LapseRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -97,7 +97,7 @@ public LapseRate(double value, LapseRateUnit unit) /// No unit was found for the given . public LapseRate(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -205,7 +205,6 @@ public LapseRate(double value, UnitSystem unitSystem) internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> LapseRateUnit - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(LapseRateUnit.DegreeCelsiusPerKilometer, LapseRateUnit.DegreeCelsiusPerKilometer, quantity => quantity); @@ -498,8 +497,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Lapse /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LapseRate objLapseRate)) throw new ArgumentException("Expected type LapseRate.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is LapseRate objLapseRate)) throw new ArgumentException("Expected type LapseRate.", nameof(obj)); return CompareTo(objLapseRate); } @@ -514,7 +513,7 @@ public int CompareTo(LapseRate other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is LapseRate objLapseRate)) + if (obj is null || !(obj is LapseRate objLapseRate)) return false; return Equals(objLapseRate); @@ -569,7 +568,7 @@ public bool Equals(LapseRate other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(LapseRate other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -597,7 +596,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(LapseRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -607,13 +606,13 @@ public double As(LapseRateUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -622,7 +621,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is LapseRateUnit unitAsLapseRateUnit)) + if (!(unit is LapseRateUnit unitAsLapseRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LapseRateUnit)} is supported.", nameof(unit)); return As(unitAsLapseRateUnit); @@ -646,18 +645,18 @@ public LapseRate ToUnit(LapseRateUnit unit) /// A LapseRate with the specified unit. public LapseRate ToUnit(LapseRateUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(LapseRate), Unit, typeof(LapseRate), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(LapseRate), Unit, typeof(LapseRate), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (LapseRate)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -672,7 +671,7 @@ public LapseRate ToUnit(LapseRateUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is LapseRateUnit unitAsLapseRateUnit)) + if (!(unit is LapseRateUnit unitAsLapseRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LapseRateUnit)} is supported.", nameof(unit)); return ToUnit(unitAsLapseRateUnit, DefaultConversionFunctions); @@ -681,7 +680,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is LapseRateUnit unitAsLapseRateUnit)) + if (!(unit is LapseRateUnit unitAsLapseRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LapseRateUnit)} is supported.", nameof(unit)); return ToUnit(unitAsLapseRateUnit, unitConverter); @@ -690,13 +689,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public LapseRate ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -871,15 +870,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(LapseRate)) + if (conversionType == typeof(LapseRate)) return this; - else if(conversionType == typeof(LapseRateUnit)) + else if (conversionType == typeof(LapseRateUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return LapseRate.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return LapseRate.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return LapseRate.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(LapseRate)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs index cb0a18fdf7..7eddcd3a22 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs @@ -111,7 +111,7 @@ static Length() /// If value is NaN or Infinity. public Length(double value, LengthUnit unit) { - if(unit == LengthUnit.Undefined) + if (unit == LengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -128,7 +128,7 @@ public Length(double value, LengthUnit unit) /// No unit was found for the given . public Length(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -428,7 +428,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(LengthUnit.Meter, LengthUnit.Twip, quantity => new Length(quantity.Value*56692.913385826, LengthUnit.Twip)); unitConverter.SetConversionFunction(LengthUnit.Meter, LengthUnit.UsSurveyFoot, quantity => new Length(quantity.Value*3937/1200, LengthUnit.UsSurveyFoot)); unitConverter.SetConversionFunction(LengthUnit.Meter, LengthUnit.Yard, quantity => new Length(quantity.Value/0.9144, LengthUnit.Yard)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(LengthUnit.Meter, LengthUnit.Meter, quantity => quantity); @@ -1103,8 +1102,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Lengt /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Length objLength)) throw new ArgumentException("Expected type Length.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Length objLength)) throw new ArgumentException("Expected type Length.", nameof(obj)); return CompareTo(objLength); } @@ -1119,7 +1118,7 @@ public int CompareTo(Length other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Length objLength)) + if (obj is null || !(obj is Length objLength)) return false; return Equals(objLength); @@ -1174,7 +1173,7 @@ public bool Equals(Length other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Length other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1202,7 +1201,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(LengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1212,13 +1211,13 @@ public double As(LengthUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1227,7 +1226,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is LengthUnit unitAsLengthUnit)) + if (!(unit is LengthUnit unitAsLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LengthUnit)} is supported.", nameof(unit)); return As(unitAsLengthUnit); @@ -1251,18 +1250,18 @@ public Length ToUnit(LengthUnit unit) /// A Length with the specified unit. public Length ToUnit(LengthUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Length), Unit, typeof(Length), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Length), Unit, typeof(Length), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Length)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1277,7 +1276,7 @@ public Length ToUnit(LengthUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is LengthUnit unitAsLengthUnit)) + if (!(unit is LengthUnit unitAsLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LengthUnit)} is supported.", nameof(unit)); return ToUnit(unitAsLengthUnit, DefaultConversionFunctions); @@ -1286,7 +1285,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is LengthUnit unitAsLengthUnit)) + if (!(unit is LengthUnit unitAsLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LengthUnit)} is supported.", nameof(unit)); return ToUnit(unitAsLengthUnit, unitConverter); @@ -1295,13 +1294,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Length ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1476,15 +1475,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Length)) + if (conversionType == typeof(Length)) return this; - else if(conversionType == typeof(LengthUnit)) + else if (conversionType == typeof(LengthUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Length.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Length.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Length.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Length)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Level.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.g.cs index 7743bc4a3a..9b18dbb221 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.g.cs @@ -80,7 +80,7 @@ static Level() /// If value is NaN or Infinity. public Level(double value, LevelUnit unit) { - if(unit == LevelUnit.Undefined) + if (unit == LevelUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -97,7 +97,7 @@ public Level(double value, LevelUnit unit) /// No unit was found for the given . public Level(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -211,7 +211,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> LevelUnit unitConverter.SetConversionFunction(LevelUnit.Decibel, LevelUnit.Neper, quantity => new Level(0.115129254*quantity.Value, LevelUnit.Neper)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(LevelUnit.Decibel, LevelUnit.Decibel, quantity => quantity); @@ -523,8 +522,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Level /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Level objLevel)) throw new ArgumentException("Expected type Level.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Level objLevel)) throw new ArgumentException("Expected type Level.", nameof(obj)); return CompareTo(objLevel); } @@ -539,7 +538,7 @@ public int CompareTo(Level other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Level objLevel)) + if (obj is null || !(obj is Level objLevel)) return false; return Equals(objLevel); @@ -594,7 +593,7 @@ public bool Equals(Level other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Level other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -622,7 +621,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(LevelUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -632,13 +631,13 @@ public double As(LevelUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -647,7 +646,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is LevelUnit unitAsLevelUnit)) + if (!(unit is LevelUnit unitAsLevelUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LevelUnit)} is supported.", nameof(unit)); return As(unitAsLevelUnit); @@ -671,18 +670,18 @@ public Level ToUnit(LevelUnit unit) /// A Level with the specified unit. public Level ToUnit(LevelUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Level), Unit, typeof(Level), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Level), Unit, typeof(Level), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Level)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -697,7 +696,7 @@ public Level ToUnit(LevelUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is LevelUnit unitAsLevelUnit)) + if (!(unit is LevelUnit unitAsLevelUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LevelUnit)} is supported.", nameof(unit)); return ToUnit(unitAsLevelUnit, DefaultConversionFunctions); @@ -706,7 +705,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is LevelUnit unitAsLevelUnit)) + if (!(unit is LevelUnit unitAsLevelUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LevelUnit)} is supported.", nameof(unit)); return ToUnit(unitAsLevelUnit, unitConverter); @@ -715,13 +714,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Level ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -896,15 +895,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Level)) + if (conversionType == typeof(Level)) return this; - else if(conversionType == typeof(LevelUnit)) + else if (conversionType == typeof(LevelUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Level.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Level.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Level.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Level)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs index b3b2c300c7..06ed4ec2f9 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs @@ -95,7 +95,7 @@ static LinearDensity() /// If value is NaN or Infinity. public LinearDensity(double value, LinearDensityUnit unit) { - if(unit == LinearDensityUnit.Undefined) + if (unit == LinearDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -112,7 +112,7 @@ public LinearDensity(double value, LinearDensityUnit unit) /// No unit was found for the given . public LinearDensity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -298,7 +298,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(LinearDensityUnit.KilogramPerMeter, LinearDensityUnit.MilligramPerMillimeter, quantity => new LinearDensity((quantity.Value) / 1e-3d, LinearDensityUnit.MilligramPerMillimeter)); unitConverter.SetConversionFunction(LinearDensityUnit.KilogramPerMeter, LinearDensityUnit.PoundPerFoot, quantity => new LinearDensity(quantity.Value/1.48816394, LinearDensityUnit.PoundPerFoot)); unitConverter.SetConversionFunction(LinearDensityUnit.KilogramPerMeter, LinearDensityUnit.PoundPerInch, quantity => new LinearDensity(quantity.Value*5.5997415e-2, LinearDensityUnit.PoundPerInch)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(LinearDensityUnit.KilogramPerMeter, LinearDensityUnit.KilogramPerMeter, quantity => quantity); @@ -734,8 +733,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Linea /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LinearDensity objLinearDensity)) throw new ArgumentException("Expected type LinearDensity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is LinearDensity objLinearDensity)) throw new ArgumentException("Expected type LinearDensity.", nameof(obj)); return CompareTo(objLinearDensity); } @@ -750,7 +749,7 @@ public int CompareTo(LinearDensity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is LinearDensity objLinearDensity)) + if (obj is null || !(obj is LinearDensity objLinearDensity)) return false; return Equals(objLinearDensity); @@ -805,7 +804,7 @@ public bool Equals(LinearDensity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(LinearDensity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -833,7 +832,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(LinearDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -843,13 +842,13 @@ public double As(LinearDensityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -858,7 +857,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is LinearDensityUnit unitAsLinearDensityUnit)) + if (!(unit is LinearDensityUnit unitAsLinearDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LinearDensityUnit)} is supported.", nameof(unit)); return As(unitAsLinearDensityUnit); @@ -882,18 +881,18 @@ public LinearDensity ToUnit(LinearDensityUnit unit) /// A LinearDensity with the specified unit. public LinearDensity ToUnit(LinearDensityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(LinearDensity), Unit, typeof(LinearDensity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(LinearDensity), Unit, typeof(LinearDensity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (LinearDensity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -908,7 +907,7 @@ public LinearDensity ToUnit(LinearDensityUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is LinearDensityUnit unitAsLinearDensityUnit)) + if (!(unit is LinearDensityUnit unitAsLinearDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LinearDensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsLinearDensityUnit, DefaultConversionFunctions); @@ -917,7 +916,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is LinearDensityUnit unitAsLinearDensityUnit)) + if (!(unit is LinearDensityUnit unitAsLinearDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LinearDensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsLinearDensityUnit, unitConverter); @@ -926,13 +925,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public LinearDensity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1107,15 +1106,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(LinearDensity)) + if (conversionType == typeof(LinearDensity)) return this; - else if(conversionType == typeof(LinearDensityUnit)) + else if (conversionType == typeof(LinearDensityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return LinearDensity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return LinearDensity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return LinearDensity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(LinearDensity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs index 58e9472307..f618c16f31 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs @@ -106,7 +106,7 @@ static LinearPowerDensity() /// If value is NaN or Infinity. public LinearPowerDensity(double value, LinearPowerDensityUnit unit) { - if(unit == LinearPowerDensityUnit.Undefined) + if (unit == LinearPowerDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -123,7 +123,7 @@ public LinearPowerDensity(double value, LinearPowerDensityUnit unit) /// No unit was found for the given . public LinearPowerDensity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -375,7 +375,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(LinearPowerDensityUnit.WattPerMeter, LinearPowerDensityUnit.WattPerFoot, quantity => new LinearPowerDensity(quantity.Value/3.280839895, LinearPowerDensityUnit.WattPerFoot)); unitConverter.SetConversionFunction(LinearPowerDensityUnit.WattPerMeter, LinearPowerDensityUnit.WattPerInch, quantity => new LinearPowerDensity(quantity.Value/39.37007874, LinearPowerDensityUnit.WattPerInch)); unitConverter.SetConversionFunction(LinearPowerDensityUnit.WattPerMeter, LinearPowerDensityUnit.WattPerMillimeter, quantity => new LinearPowerDensity(quantity.Value/1e3, LinearPowerDensityUnit.WattPerMillimeter)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(LinearPowerDensityUnit.WattPerMeter, LinearPowerDensityUnit.WattPerMeter, quantity => quantity); @@ -932,8 +931,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Linea /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LinearPowerDensity objLinearPowerDensity)) throw new ArgumentException("Expected type LinearPowerDensity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is LinearPowerDensity objLinearPowerDensity)) throw new ArgumentException("Expected type LinearPowerDensity.", nameof(obj)); return CompareTo(objLinearPowerDensity); } @@ -948,7 +947,7 @@ public int CompareTo(LinearPowerDensity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is LinearPowerDensity objLinearPowerDensity)) + if (obj is null || !(obj is LinearPowerDensity objLinearPowerDensity)) return false; return Equals(objLinearPowerDensity); @@ -1003,7 +1002,7 @@ public bool Equals(LinearPowerDensity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(LinearPowerDensity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1031,7 +1030,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(LinearPowerDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1041,13 +1040,13 @@ public double As(LinearPowerDensityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1056,7 +1055,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is LinearPowerDensityUnit unitAsLinearPowerDensityUnit)) + if (!(unit is LinearPowerDensityUnit unitAsLinearPowerDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LinearPowerDensityUnit)} is supported.", nameof(unit)); return As(unitAsLinearPowerDensityUnit); @@ -1080,18 +1079,18 @@ public LinearPowerDensity ToUnit(LinearPowerDensityUnit unit) /// A LinearPowerDensity with the specified unit. public LinearPowerDensity ToUnit(LinearPowerDensityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(LinearPowerDensity), Unit, typeof(LinearPowerDensity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(LinearPowerDensity), Unit, typeof(LinearPowerDensity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (LinearPowerDensity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1106,7 +1105,7 @@ public LinearPowerDensity ToUnit(LinearPowerDensityUnit unit, UnitConverter unit /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is LinearPowerDensityUnit unitAsLinearPowerDensityUnit)) + if (!(unit is LinearPowerDensityUnit unitAsLinearPowerDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LinearPowerDensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsLinearPowerDensityUnit, DefaultConversionFunctions); @@ -1115,7 +1114,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is LinearPowerDensityUnit unitAsLinearPowerDensityUnit)) + if (!(unit is LinearPowerDensityUnit unitAsLinearPowerDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LinearPowerDensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsLinearPowerDensityUnit, unitConverter); @@ -1124,13 +1123,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public LinearPowerDensity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1305,15 +1304,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(LinearPowerDensity)) + if (conversionType == typeof(LinearPowerDensity)) return this; - else if(conversionType == typeof(LinearPowerDensityUnit)) + else if (conversionType == typeof(LinearPowerDensityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return LinearPowerDensity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return LinearPowerDensity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return LinearPowerDensity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(LinearPowerDensity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs index 6013e1904f..dfc24117bb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs @@ -95,7 +95,7 @@ static Luminosity() /// If value is NaN or Infinity. public Luminosity(double value, LuminosityUnit unit) { - if(unit == LuminosityUnit.Undefined) + if (unit == LuminosityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -112,7 +112,7 @@ public Luminosity(double value, LuminosityUnit unit) /// No unit was found for the given . public Luminosity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -298,7 +298,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(LuminosityUnit.Watt, LuminosityUnit.Picowatt, quantity => new Luminosity((quantity.Value) / 1e-12d, LuminosityUnit.Picowatt)); unitConverter.SetConversionFunction(LuminosityUnit.Watt, LuminosityUnit.SolarLuminosity, quantity => new Luminosity(quantity.Value / 3.846e26, LuminosityUnit.SolarLuminosity)); unitConverter.SetConversionFunction(LuminosityUnit.Watt, LuminosityUnit.Terawatt, quantity => new Luminosity((quantity.Value) / 1e12d, LuminosityUnit.Terawatt)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(LuminosityUnit.Watt, LuminosityUnit.Watt, quantity => quantity); @@ -734,8 +733,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Lumin /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Luminosity objLuminosity)) throw new ArgumentException("Expected type Luminosity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Luminosity objLuminosity)) throw new ArgumentException("Expected type Luminosity.", nameof(obj)); return CompareTo(objLuminosity); } @@ -750,7 +749,7 @@ public int CompareTo(Luminosity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Luminosity objLuminosity)) + if (obj is null || !(obj is Luminosity objLuminosity)) return false; return Equals(objLuminosity); @@ -805,7 +804,7 @@ public bool Equals(Luminosity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Luminosity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -833,7 +832,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(LuminosityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -843,13 +842,13 @@ public double As(LuminosityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -858,7 +857,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is LuminosityUnit unitAsLuminosityUnit)) + if (!(unit is LuminosityUnit unitAsLuminosityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminosityUnit)} is supported.", nameof(unit)); return As(unitAsLuminosityUnit); @@ -882,18 +881,18 @@ public Luminosity ToUnit(LuminosityUnit unit) /// A Luminosity with the specified unit. public Luminosity ToUnit(LuminosityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Luminosity), Unit, typeof(Luminosity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Luminosity), Unit, typeof(Luminosity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Luminosity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -908,7 +907,7 @@ public Luminosity ToUnit(LuminosityUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is LuminosityUnit unitAsLuminosityUnit)) + if (!(unit is LuminosityUnit unitAsLuminosityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminosityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsLuminosityUnit, DefaultConversionFunctions); @@ -917,7 +916,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is LuminosityUnit unitAsLuminosityUnit)) + if (!(unit is LuminosityUnit unitAsLuminosityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminosityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsLuminosityUnit, unitConverter); @@ -926,13 +925,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Luminosity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1107,15 +1106,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Luminosity)) + if (conversionType == typeof(Luminosity)) return this; - else if(conversionType == typeof(LuminosityUnit)) + else if (conversionType == typeof(LuminosityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Luminosity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Luminosity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Luminosity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Luminosity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs index 139953a5b5..3467920176 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs @@ -82,7 +82,7 @@ static LuminousFlux() /// If value is NaN or Infinity. public LuminousFlux(double value, LuminousFluxUnit unit) { - if(unit == LuminousFluxUnit.Undefined) + if (unit == LuminousFluxUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public LuminousFlux(double value, LuminousFluxUnit unit) /// No unit was found for the given . public LuminousFlux(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -207,7 +207,6 @@ public LuminousFlux(double value, UnitSystem unitSystem) internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> LuminousFluxUnit - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(LuminousFluxUnit.Lumen, LuminousFluxUnit.Lumen, quantity => quantity); @@ -500,8 +499,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Lumin /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LuminousFlux objLuminousFlux)) throw new ArgumentException("Expected type LuminousFlux.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is LuminousFlux objLuminousFlux)) throw new ArgumentException("Expected type LuminousFlux.", nameof(obj)); return CompareTo(objLuminousFlux); } @@ -516,7 +515,7 @@ public int CompareTo(LuminousFlux other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is LuminousFlux objLuminousFlux)) + if (obj is null || !(obj is LuminousFlux objLuminousFlux)) return false; return Equals(objLuminousFlux); @@ -571,7 +570,7 @@ public bool Equals(LuminousFlux other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(LuminousFlux other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -599,7 +598,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(LuminousFluxUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -609,13 +608,13 @@ public double As(LuminousFluxUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -624,7 +623,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is LuminousFluxUnit unitAsLuminousFluxUnit)) + if (!(unit is LuminousFluxUnit unitAsLuminousFluxUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminousFluxUnit)} is supported.", nameof(unit)); return As(unitAsLuminousFluxUnit); @@ -648,18 +647,18 @@ public LuminousFlux ToUnit(LuminousFluxUnit unit) /// A LuminousFlux with the specified unit. public LuminousFlux ToUnit(LuminousFluxUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(LuminousFlux), Unit, typeof(LuminousFlux), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(LuminousFlux), Unit, typeof(LuminousFlux), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (LuminousFlux)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -674,7 +673,7 @@ public LuminousFlux ToUnit(LuminousFluxUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is LuminousFluxUnit unitAsLuminousFluxUnit)) + if (!(unit is LuminousFluxUnit unitAsLuminousFluxUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminousFluxUnit)} is supported.", nameof(unit)); return ToUnit(unitAsLuminousFluxUnit, DefaultConversionFunctions); @@ -683,7 +682,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is LuminousFluxUnit unitAsLuminousFluxUnit)) + if (!(unit is LuminousFluxUnit unitAsLuminousFluxUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminousFluxUnit)} is supported.", nameof(unit)); return ToUnit(unitAsLuminousFluxUnit, unitConverter); @@ -692,13 +691,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public LuminousFlux ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -873,15 +872,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(LuminousFlux)) + if (conversionType == typeof(LuminousFlux)) return this; - else if(conversionType == typeof(LuminousFluxUnit)) + else if (conversionType == typeof(LuminousFluxUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return LuminousFlux.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return LuminousFlux.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return LuminousFlux.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs index 75e1825474..a1bc30a291 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -82,7 +82,7 @@ static LuminousIntensity() /// If value is NaN or Infinity. public LuminousIntensity(double value, LuminousIntensityUnit unit) { - if(unit == LuminousIntensityUnit.Undefined) + if (unit == LuminousIntensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public LuminousIntensity(double value, LuminousIntensityUnit unit) /// No unit was found for the given . public LuminousIntensity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -207,7 +207,6 @@ public LuminousIntensity(double value, UnitSystem unitSystem) internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> LuminousIntensityUnit - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(LuminousIntensityUnit.Candela, LuminousIntensityUnit.Candela, quantity => quantity); @@ -500,8 +499,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Lumin /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LuminousIntensity objLuminousIntensity)) throw new ArgumentException("Expected type LuminousIntensity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is LuminousIntensity objLuminousIntensity)) throw new ArgumentException("Expected type LuminousIntensity.", nameof(obj)); return CompareTo(objLuminousIntensity); } @@ -516,7 +515,7 @@ public int CompareTo(LuminousIntensity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is LuminousIntensity objLuminousIntensity)) + if (obj is null || !(obj is LuminousIntensity objLuminousIntensity)) return false; return Equals(objLuminousIntensity); @@ -571,7 +570,7 @@ public bool Equals(LuminousIntensity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(LuminousIntensity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -599,7 +598,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(LuminousIntensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -609,13 +608,13 @@ public double As(LuminousIntensityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -624,7 +623,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is LuminousIntensityUnit unitAsLuminousIntensityUnit)) + if (!(unit is LuminousIntensityUnit unitAsLuminousIntensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminousIntensityUnit)} is supported.", nameof(unit)); return As(unitAsLuminousIntensityUnit); @@ -648,18 +647,18 @@ public LuminousIntensity ToUnit(LuminousIntensityUnit unit) /// A LuminousIntensity with the specified unit. public LuminousIntensity ToUnit(LuminousIntensityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(LuminousIntensity), Unit, typeof(LuminousIntensity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(LuminousIntensity), Unit, typeof(LuminousIntensity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (LuminousIntensity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -674,7 +673,7 @@ public LuminousIntensity ToUnit(LuminousIntensityUnit unit, UnitConverter unitCo /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is LuminousIntensityUnit unitAsLuminousIntensityUnit)) + if (!(unit is LuminousIntensityUnit unitAsLuminousIntensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminousIntensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsLuminousIntensityUnit, DefaultConversionFunctions); @@ -683,7 +682,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is LuminousIntensityUnit unitAsLuminousIntensityUnit)) + if (!(unit is LuminousIntensityUnit unitAsLuminousIntensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminousIntensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsLuminousIntensityUnit, unitConverter); @@ -692,13 +691,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public LuminousIntensity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -873,15 +872,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(LuminousIntensity)) + if (conversionType == typeof(LuminousIntensity)) return this; - else if(conversionType == typeof(LuminousIntensityUnit)) + else if (conversionType == typeof(LuminousIntensityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return LuminousIntensity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return LuminousIntensity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return LuminousIntensity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs index c309df219a..a8b2a877af 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs @@ -87,7 +87,7 @@ static MagneticField() /// If value is NaN or Infinity. public MagneticField(double value, MagneticFieldUnit unit) { - if(unit == MagneticFieldUnit.Undefined) + if (unit == MagneticFieldUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -104,7 +104,7 @@ public MagneticField(double value, MagneticFieldUnit unit) /// No unit was found for the given . public MagneticField(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -242,7 +242,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(MagneticFieldUnit.Tesla, MagneticFieldUnit.Milligauss, quantity => new MagneticField((quantity.Value*1e4) / 1e-3d, MagneticFieldUnit.Milligauss)); unitConverter.SetConversionFunction(MagneticFieldUnit.Tesla, MagneticFieldUnit.Millitesla, quantity => new MagneticField((quantity.Value) / 1e-3d, MagneticFieldUnit.Millitesla)); unitConverter.SetConversionFunction(MagneticFieldUnit.Tesla, MagneticFieldUnit.Nanotesla, quantity => new MagneticField((quantity.Value) / 1e-9d, MagneticFieldUnit.Nanotesla)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(MagneticFieldUnit.Tesla, MagneticFieldUnit.Tesla, quantity => quantity); @@ -590,8 +589,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Magne /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MagneticField objMagneticField)) throw new ArgumentException("Expected type MagneticField.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MagneticField objMagneticField)) throw new ArgumentException("Expected type MagneticField.", nameof(obj)); return CompareTo(objMagneticField); } @@ -606,7 +605,7 @@ public int CompareTo(MagneticField other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MagneticField objMagneticField)) + if (obj is null || !(obj is MagneticField objMagneticField)) return false; return Equals(objMagneticField); @@ -661,7 +660,7 @@ public bool Equals(MagneticField other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MagneticField other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -689,7 +688,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MagneticFieldUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -699,13 +698,13 @@ public double As(MagneticFieldUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -714,7 +713,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is MagneticFieldUnit unitAsMagneticFieldUnit)) + if (!(unit is MagneticFieldUnit unitAsMagneticFieldUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagneticFieldUnit)} is supported.", nameof(unit)); return As(unitAsMagneticFieldUnit); @@ -738,18 +737,18 @@ public MagneticField ToUnit(MagneticFieldUnit unit) /// A MagneticField with the specified unit. public MagneticField ToUnit(MagneticFieldUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(MagneticField), Unit, typeof(MagneticField), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(MagneticField), Unit, typeof(MagneticField), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (MagneticField)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -764,7 +763,7 @@ public MagneticField ToUnit(MagneticFieldUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is MagneticFieldUnit unitAsMagneticFieldUnit)) + if (!(unit is MagneticFieldUnit unitAsMagneticFieldUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagneticFieldUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMagneticFieldUnit, DefaultConversionFunctions); @@ -773,7 +772,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is MagneticFieldUnit unitAsMagneticFieldUnit)) + if (!(unit is MagneticFieldUnit unitAsMagneticFieldUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagneticFieldUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMagneticFieldUnit, unitConverter); @@ -782,13 +781,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public MagneticField ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -963,15 +962,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MagneticField)) + if (conversionType == typeof(MagneticField)) return this; - else if(conversionType == typeof(MagneticFieldUnit)) + else if (conversionType == typeof(MagneticFieldUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return MagneticField.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return MagneticField.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return MagneticField.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(MagneticField)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs index d5aae771cf..d989040f9a 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs @@ -82,7 +82,7 @@ static MagneticFlux() /// If value is NaN or Infinity. public MagneticFlux(double value, MagneticFluxUnit unit) { - if(unit == MagneticFluxUnit.Undefined) + if (unit == MagneticFluxUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public MagneticFlux(double value, MagneticFluxUnit unit) /// No unit was found for the given . public MagneticFlux(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -207,7 +207,6 @@ public MagneticFlux(double value, UnitSystem unitSystem) internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> MagneticFluxUnit - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(MagneticFluxUnit.Weber, MagneticFluxUnit.Weber, quantity => quantity); @@ -500,8 +499,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Magne /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MagneticFlux objMagneticFlux)) throw new ArgumentException("Expected type MagneticFlux.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MagneticFlux objMagneticFlux)) throw new ArgumentException("Expected type MagneticFlux.", nameof(obj)); return CompareTo(objMagneticFlux); } @@ -516,7 +515,7 @@ public int CompareTo(MagneticFlux other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MagneticFlux objMagneticFlux)) + if (obj is null || !(obj is MagneticFlux objMagneticFlux)) return false; return Equals(objMagneticFlux); @@ -571,7 +570,7 @@ public bool Equals(MagneticFlux other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MagneticFlux other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -599,7 +598,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MagneticFluxUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -609,13 +608,13 @@ public double As(MagneticFluxUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -624,7 +623,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is MagneticFluxUnit unitAsMagneticFluxUnit)) + if (!(unit is MagneticFluxUnit unitAsMagneticFluxUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagneticFluxUnit)} is supported.", nameof(unit)); return As(unitAsMagneticFluxUnit); @@ -648,18 +647,18 @@ public MagneticFlux ToUnit(MagneticFluxUnit unit) /// A MagneticFlux with the specified unit. public MagneticFlux ToUnit(MagneticFluxUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(MagneticFlux), Unit, typeof(MagneticFlux), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(MagneticFlux), Unit, typeof(MagneticFlux), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (MagneticFlux)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -674,7 +673,7 @@ public MagneticFlux ToUnit(MagneticFluxUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is MagneticFluxUnit unitAsMagneticFluxUnit)) + if (!(unit is MagneticFluxUnit unitAsMagneticFluxUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagneticFluxUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMagneticFluxUnit, DefaultConversionFunctions); @@ -683,7 +682,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is MagneticFluxUnit unitAsMagneticFluxUnit)) + if (!(unit is MagneticFluxUnit unitAsMagneticFluxUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagneticFluxUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMagneticFluxUnit, unitConverter); @@ -692,13 +691,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public MagneticFlux ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -873,15 +872,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MagneticFlux)) + if (conversionType == typeof(MagneticFlux)) return this; - else if(conversionType == typeof(MagneticFluxUnit)) + else if (conversionType == typeof(MagneticFluxUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return MagneticFlux.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return MagneticFlux.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return MagneticFlux.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs index 042a92d262..313ddaed0f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs @@ -82,7 +82,7 @@ static Magnetization() /// If value is NaN or Infinity. public Magnetization(double value, MagnetizationUnit unit) { - if(unit == MagnetizationUnit.Undefined) + if (unit == MagnetizationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public Magnetization(double value, MagnetizationUnit unit) /// No unit was found for the given . public Magnetization(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -207,7 +207,6 @@ public Magnetization(double value, UnitSystem unitSystem) internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> MagnetizationUnit - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(MagnetizationUnit.AmperePerMeter, MagnetizationUnit.AmperePerMeter, quantity => quantity); @@ -500,8 +499,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Magne /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Magnetization objMagnetization)) throw new ArgumentException("Expected type Magnetization.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Magnetization objMagnetization)) throw new ArgumentException("Expected type Magnetization.", nameof(obj)); return CompareTo(objMagnetization); } @@ -516,7 +515,7 @@ public int CompareTo(Magnetization other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Magnetization objMagnetization)) + if (obj is null || !(obj is Magnetization objMagnetization)) return false; return Equals(objMagnetization); @@ -571,7 +570,7 @@ public bool Equals(Magnetization other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Magnetization other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -599,7 +598,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MagnetizationUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -609,13 +608,13 @@ public double As(MagnetizationUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -624,7 +623,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is MagnetizationUnit unitAsMagnetizationUnit)) + if (!(unit is MagnetizationUnit unitAsMagnetizationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagnetizationUnit)} is supported.", nameof(unit)); return As(unitAsMagnetizationUnit); @@ -648,18 +647,18 @@ public Magnetization ToUnit(MagnetizationUnit unit) /// A Magnetization with the specified unit. public Magnetization ToUnit(MagnetizationUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Magnetization), Unit, typeof(Magnetization), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Magnetization), Unit, typeof(Magnetization), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Magnetization)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -674,7 +673,7 @@ public Magnetization ToUnit(MagnetizationUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is MagnetizationUnit unitAsMagnetizationUnit)) + if (!(unit is MagnetizationUnit unitAsMagnetizationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagnetizationUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMagnetizationUnit, DefaultConversionFunctions); @@ -683,7 +682,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is MagnetizationUnit unitAsMagnetizationUnit)) + if (!(unit is MagnetizationUnit unitAsMagnetizationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagnetizationUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMagnetizationUnit, unitConverter); @@ -692,13 +691,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Magnetization ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -873,15 +872,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Magnetization)) + if (conversionType == typeof(Magnetization)) return this; - else if(conversionType == typeof(MagnetizationUnit)) + else if (conversionType == typeof(MagnetizationUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Magnetization.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Magnetization.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Magnetization.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Magnetization)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs index 2f8d9e5fce..30f46e6292 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs @@ -103,7 +103,7 @@ static Mass() /// If value is NaN or Infinity. public Mass(double value, MassUnit unit) { - if(unit == MassUnit.Undefined) + if (unit == MassUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -120,7 +120,7 @@ public Mass(double value, MassUnit unit) /// No unit was found for the given . public Mass(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -372,7 +372,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(MassUnit.Kilogram, MassUnit.SolarMass, quantity => new Mass(quantity.Value / 1.98947e30, MassUnit.SolarMass)); unitConverter.SetConversionFunction(MassUnit.Kilogram, MassUnit.Stone, quantity => new Mass(quantity.Value*0.1574731728702698, MassUnit.Stone)); unitConverter.SetConversionFunction(MassUnit.Kilogram, MassUnit.Tonne, quantity => new Mass(quantity.Value/1e3, MassUnit.Tonne)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(MassUnit.Kilogram, MassUnit.Kilogram, quantity => quantity); @@ -964,8 +963,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassU /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Mass objMass)) throw new ArgumentException("Expected type Mass.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Mass objMass)) throw new ArgumentException("Expected type Mass.", nameof(obj)); return CompareTo(objMass); } @@ -980,7 +979,7 @@ public int CompareTo(Mass other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Mass objMass)) + if (obj is null || !(obj is Mass objMass)) return false; return Equals(objMass); @@ -1035,7 +1034,7 @@ public bool Equals(Mass other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Mass other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1063,7 +1062,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MassUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1073,13 +1072,13 @@ public double As(MassUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1088,7 +1087,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is MassUnit unitAsMassUnit)) + if (!(unit is MassUnit unitAsMassUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassUnit)} is supported.", nameof(unit)); return As(unitAsMassUnit); @@ -1112,18 +1111,18 @@ public Mass ToUnit(MassUnit unit) /// A Mass with the specified unit. public Mass ToUnit(MassUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Mass), Unit, typeof(Mass), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Mass), Unit, typeof(Mass), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Mass)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1138,7 +1137,7 @@ public Mass ToUnit(MassUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is MassUnit unitAsMassUnit)) + if (!(unit is MassUnit unitAsMassUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMassUnit, DefaultConversionFunctions); @@ -1147,7 +1146,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is MassUnit unitAsMassUnit)) + if (!(unit is MassUnit unitAsMassUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMassUnit, unitConverter); @@ -1156,13 +1155,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Mass ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1337,15 +1336,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Mass)) + if (conversionType == typeof(Mass)) return this; - else if(conversionType == typeof(MassUnit)) + else if (conversionType == typeof(MassUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Mass.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Mass.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Mass.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Mass)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs index f2b53ab387..2d27a5b0f3 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs @@ -130,7 +130,7 @@ static MassConcentration() /// If value is NaN or Infinity. public MassConcentration(double value, MassConcentrationUnit unit) { - if(unit == MassConcentrationUnit.Undefined) + if (unit == MassConcentrationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -147,7 +147,7 @@ public MassConcentration(double value, MassConcentrationUnit unit) /// No unit was found for the given . public MassConcentration(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -543,7 +543,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(MassConcentrationUnit.KilogramPerCubicMeter, MassConcentrationUnit.TonnePerCubicCentimeter, quantity => new MassConcentration(quantity.Value*1e-9, MassConcentrationUnit.TonnePerCubicCentimeter)); unitConverter.SetConversionFunction(MassConcentrationUnit.KilogramPerCubicMeter, MassConcentrationUnit.TonnePerCubicMeter, quantity => new MassConcentration(quantity.Value*0.001, MassConcentrationUnit.TonnePerCubicMeter)); unitConverter.SetConversionFunction(MassConcentrationUnit.KilogramPerCubicMeter, MassConcentrationUnit.TonnePerCubicMillimeter, quantity => new MassConcentration(quantity.Value*1e-12, MassConcentrationUnit.TonnePerCubicMillimeter)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(MassConcentrationUnit.KilogramPerCubicMeter, MassConcentrationUnit.KilogramPerCubicMeter, quantity => quantity); @@ -1368,8 +1367,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassC /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassConcentration objMassConcentration)) throw new ArgumentException("Expected type MassConcentration.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MassConcentration objMassConcentration)) throw new ArgumentException("Expected type MassConcentration.", nameof(obj)); return CompareTo(objMassConcentration); } @@ -1384,7 +1383,7 @@ public int CompareTo(MassConcentration other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MassConcentration objMassConcentration)) + if (obj is null || !(obj is MassConcentration objMassConcentration)) return false; return Equals(objMassConcentration); @@ -1439,7 +1438,7 @@ public bool Equals(MassConcentration other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MassConcentration other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1467,7 +1466,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MassConcentrationUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1477,13 +1476,13 @@ public double As(MassConcentrationUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1492,7 +1491,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is MassConcentrationUnit unitAsMassConcentrationUnit)) + if (!(unit is MassConcentrationUnit unitAsMassConcentrationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassConcentrationUnit)} is supported.", nameof(unit)); return As(unitAsMassConcentrationUnit); @@ -1516,18 +1515,18 @@ public MassConcentration ToUnit(MassConcentrationUnit unit) /// A MassConcentration with the specified unit. public MassConcentration ToUnit(MassConcentrationUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(MassConcentration), Unit, typeof(MassConcentration), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(MassConcentration), Unit, typeof(MassConcentration), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (MassConcentration)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1542,7 +1541,7 @@ public MassConcentration ToUnit(MassConcentrationUnit unit, UnitConverter unitCo /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is MassConcentrationUnit unitAsMassConcentrationUnit)) + if (!(unit is MassConcentrationUnit unitAsMassConcentrationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassConcentrationUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMassConcentrationUnit, DefaultConversionFunctions); @@ -1551,7 +1550,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is MassConcentrationUnit unitAsMassConcentrationUnit)) + if (!(unit is MassConcentrationUnit unitAsMassConcentrationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassConcentrationUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMassConcentrationUnit, unitConverter); @@ -1560,13 +1559,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public MassConcentration ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1741,15 +1740,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MassConcentration)) + if (conversionType == typeof(MassConcentration)) return this; - else if(conversionType == typeof(MassConcentrationUnit)) + else if (conversionType == typeof(MassConcentrationUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return MassConcentration.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return MassConcentration.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return MassConcentration.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(MassConcentration)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs index 37227a2482..8d477d3e95 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs @@ -111,7 +111,7 @@ static MassFlow() /// If value is NaN or Infinity. public MassFlow(double value, MassFlowUnit unit) { - if(unit == MassFlowUnit.Undefined) + if (unit == MassFlowUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -128,7 +128,7 @@ public MassFlow(double value, MassFlowUnit unit) /// No unit was found for the given . public MassFlow(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -428,7 +428,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(MassFlowUnit.GramPerSecond, MassFlowUnit.ShortTonPerHour, quantity => new MassFlow(quantity.Value/251.9957611, MassFlowUnit.ShortTonPerHour)); unitConverter.SetConversionFunction(MassFlowUnit.GramPerSecond, MassFlowUnit.TonnePerDay, quantity => new MassFlow(quantity.Value*0.0864000, MassFlowUnit.TonnePerDay)); unitConverter.SetConversionFunction(MassFlowUnit.GramPerSecond, MassFlowUnit.TonnePerHour, quantity => new MassFlow(quantity.Value*3.6/1000, MassFlowUnit.TonnePerHour)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(MassFlowUnit.GramPerSecond, MassFlowUnit.GramPerSecond, quantity => quantity); @@ -1075,8 +1074,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassF /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassFlow objMassFlow)) throw new ArgumentException("Expected type MassFlow.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MassFlow objMassFlow)) throw new ArgumentException("Expected type MassFlow.", nameof(obj)); return CompareTo(objMassFlow); } @@ -1091,7 +1090,7 @@ public int CompareTo(MassFlow other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MassFlow objMassFlow)) + if (obj is null || !(obj is MassFlow objMassFlow)) return false; return Equals(objMassFlow); @@ -1146,7 +1145,7 @@ public bool Equals(MassFlow other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MassFlow other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1174,7 +1173,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MassFlowUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1184,13 +1183,13 @@ public double As(MassFlowUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1199,7 +1198,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is MassFlowUnit unitAsMassFlowUnit)) + if (!(unit is MassFlowUnit unitAsMassFlowUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFlowUnit)} is supported.", nameof(unit)); return As(unitAsMassFlowUnit); @@ -1223,18 +1222,18 @@ public MassFlow ToUnit(MassFlowUnit unit) /// A MassFlow with the specified unit. public MassFlow ToUnit(MassFlowUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(MassFlow), Unit, typeof(MassFlow), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(MassFlow), Unit, typeof(MassFlow), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (MassFlow)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1249,7 +1248,7 @@ public MassFlow ToUnit(MassFlowUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is MassFlowUnit unitAsMassFlowUnit)) + if (!(unit is MassFlowUnit unitAsMassFlowUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFlowUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMassFlowUnit, DefaultConversionFunctions); @@ -1258,7 +1257,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is MassFlowUnit unitAsMassFlowUnit)) + if (!(unit is MassFlowUnit unitAsMassFlowUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFlowUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMassFlowUnit, unitConverter); @@ -1267,13 +1266,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public MassFlow ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1448,15 +1447,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MassFlow)) + if (conversionType == typeof(MassFlow)) return this; - else if(conversionType == typeof(MassFlowUnit)) + else if (conversionType == typeof(MassFlowUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return MassFlow.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return MassFlow.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return MassFlow.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(MassFlow)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs index 3e53004a83..c6721d6857 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs @@ -90,7 +90,7 @@ static MassFlux() /// If value is NaN or Infinity. public MassFlux(double value, MassFluxUnit unit) { - if(unit == MassFluxUnit.Undefined) + if (unit == MassFluxUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -107,7 +107,7 @@ public MassFlux(double value, MassFluxUnit unit) /// No unit was found for the given . public MassFlux(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -281,7 +281,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(MassFluxUnit.KilogramPerSecondPerSquareMeter, MassFluxUnit.KilogramPerHourPerSquareMillimeter, quantity => new MassFlux((quantity.Value*3.6e0) / 1e3d, MassFluxUnit.KilogramPerHourPerSquareMillimeter)); unitConverter.SetConversionFunction(MassFluxUnit.KilogramPerSecondPerSquareMeter, MassFluxUnit.KilogramPerSecondPerSquareCentimeter, quantity => new MassFlux((quantity.Value*1e-1) / 1e3d, MassFluxUnit.KilogramPerSecondPerSquareCentimeter)); unitConverter.SetConversionFunction(MassFluxUnit.KilogramPerSecondPerSquareMeter, MassFluxUnit.KilogramPerSecondPerSquareMillimeter, quantity => new MassFlux((quantity.Value*1e-3) / 1e3d, MassFluxUnit.KilogramPerSecondPerSquareMillimeter)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(MassFluxUnit.KilogramPerSecondPerSquareMeter, MassFluxUnit.KilogramPerSecondPerSquareMeter, quantity => quantity); @@ -695,8 +694,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassF /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassFlux objMassFlux)) throw new ArgumentException("Expected type MassFlux.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MassFlux objMassFlux)) throw new ArgumentException("Expected type MassFlux.", nameof(obj)); return CompareTo(objMassFlux); } @@ -711,7 +710,7 @@ public int CompareTo(MassFlux other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MassFlux objMassFlux)) + if (obj is null || !(obj is MassFlux objMassFlux)) return false; return Equals(objMassFlux); @@ -766,7 +765,7 @@ public bool Equals(MassFlux other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MassFlux other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -794,7 +793,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MassFluxUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -804,13 +803,13 @@ public double As(MassFluxUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -819,7 +818,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is MassFluxUnit unitAsMassFluxUnit)) + if (!(unit is MassFluxUnit unitAsMassFluxUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFluxUnit)} is supported.", nameof(unit)); return As(unitAsMassFluxUnit); @@ -843,18 +842,18 @@ public MassFlux ToUnit(MassFluxUnit unit) /// A MassFlux with the specified unit. public MassFlux ToUnit(MassFluxUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(MassFlux), Unit, typeof(MassFlux), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(MassFlux), Unit, typeof(MassFlux), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (MassFlux)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -869,7 +868,7 @@ public MassFlux ToUnit(MassFluxUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is MassFluxUnit unitAsMassFluxUnit)) + if (!(unit is MassFluxUnit unitAsMassFluxUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFluxUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMassFluxUnit, DefaultConversionFunctions); @@ -878,7 +877,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is MassFluxUnit unitAsMassFluxUnit)) + if (!(unit is MassFluxUnit unitAsMassFluxUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFluxUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMassFluxUnit, unitConverter); @@ -887,13 +886,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public MassFlux ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1068,15 +1067,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MassFlux)) + if (conversionType == typeof(MassFlux)) return this; - else if(conversionType == typeof(MassFluxUnit)) + else if (conversionType == typeof(MassFluxUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return MassFlux.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return MassFlux.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return MassFlux.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(MassFlux)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs index 857b894f08..7c332e756c 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs @@ -105,7 +105,7 @@ static MassFraction() /// If value is NaN or Infinity. public MassFraction(double value, MassFractionUnit unit) { - if(unit == MassFractionUnit.Undefined) + if (unit == MassFractionUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -122,7 +122,7 @@ public MassFraction(double value, MassFractionUnit unit) /// No unit was found for the given . public MassFraction(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -368,7 +368,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(MassFractionUnit.DecimalFraction, MassFractionUnit.PartPerThousand, quantity => new MassFraction(quantity.Value*1e3, MassFractionUnit.PartPerThousand)); unitConverter.SetConversionFunction(MassFractionUnit.DecimalFraction, MassFractionUnit.PartPerTrillion, quantity => new MassFraction(quantity.Value*1e12, MassFractionUnit.PartPerTrillion)); unitConverter.SetConversionFunction(MassFractionUnit.DecimalFraction, MassFractionUnit.Percent, quantity => new MassFraction(quantity.Value*1e2, MassFractionUnit.Percent)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(MassFractionUnit.DecimalFraction, MassFractionUnit.DecimalFraction, quantity => quantity); @@ -914,8 +913,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassF /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassFraction objMassFraction)) throw new ArgumentException("Expected type MassFraction.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MassFraction objMassFraction)) throw new ArgumentException("Expected type MassFraction.", nameof(obj)); return CompareTo(objMassFraction); } @@ -930,7 +929,7 @@ public int CompareTo(MassFraction other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MassFraction objMassFraction)) + if (obj is null || !(obj is MassFraction objMassFraction)) return false; return Equals(objMassFraction); @@ -985,7 +984,7 @@ public bool Equals(MassFraction other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MassFraction other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1013,7 +1012,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MassFractionUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1023,13 +1022,13 @@ public double As(MassFractionUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1038,7 +1037,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is MassFractionUnit unitAsMassFractionUnit)) + if (!(unit is MassFractionUnit unitAsMassFractionUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFractionUnit)} is supported.", nameof(unit)); return As(unitAsMassFractionUnit); @@ -1062,18 +1061,18 @@ public MassFraction ToUnit(MassFractionUnit unit) /// A MassFraction with the specified unit. public MassFraction ToUnit(MassFractionUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(MassFraction), Unit, typeof(MassFraction), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(MassFraction), Unit, typeof(MassFraction), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (MassFraction)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1088,7 +1087,7 @@ public MassFraction ToUnit(MassFractionUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is MassFractionUnit unitAsMassFractionUnit)) + if (!(unit is MassFractionUnit unitAsMassFractionUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFractionUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMassFractionUnit, DefaultConversionFunctions); @@ -1097,7 +1096,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is MassFractionUnit unitAsMassFractionUnit)) + if (!(unit is MassFractionUnit unitAsMassFractionUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFractionUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMassFractionUnit, unitConverter); @@ -1106,13 +1105,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public MassFraction ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1287,15 +1286,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MassFraction)) + if (conversionType == typeof(MassFraction)) return this; - else if(conversionType == typeof(MassFractionUnit)) + else if (conversionType == typeof(MassFractionUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return MassFraction.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return MassFraction.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return MassFraction.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(MassFraction)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs index 4d8015bd24..808ea883a5 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs @@ -106,7 +106,7 @@ static MassMomentOfInertia() /// If value is NaN or Infinity. public MassMomentOfInertia(double value, MassMomentOfInertiaUnit unit) { - if(unit == MassMomentOfInertiaUnit.Undefined) + if (unit == MassMomentOfInertiaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -123,7 +123,7 @@ public MassMomentOfInertia(double value, MassMomentOfInertiaUnit unit) /// No unit was found for the given . public MassMomentOfInertia(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -393,7 +393,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.KilogramSquareMeter, MassMomentOfInertiaUnit.TonneSquareDecimeter, quantity => new MassMomentOfInertia(quantity.Value*1e-1, MassMomentOfInertiaUnit.TonneSquareDecimeter)); unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.KilogramSquareMeter, MassMomentOfInertiaUnit.TonneSquareMeter, quantity => new MassMomentOfInertia(quantity.Value*1e-3, MassMomentOfInertiaUnit.TonneSquareMeter)); unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.KilogramSquareMeter, MassMomentOfInertiaUnit.TonneSquareMilimeter, quantity => new MassMomentOfInertia(quantity.Value*1e3, MassMomentOfInertiaUnit.TonneSquareMilimeter)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(MassMomentOfInertiaUnit.KilogramSquareMeter, MassMomentOfInertiaUnit.KilogramSquareMeter, quantity => quantity); @@ -983,8 +982,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassM /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassMomentOfInertia objMassMomentOfInertia)) throw new ArgumentException("Expected type MassMomentOfInertia.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MassMomentOfInertia objMassMomentOfInertia)) throw new ArgumentException("Expected type MassMomentOfInertia.", nameof(obj)); return CompareTo(objMassMomentOfInertia); } @@ -999,7 +998,7 @@ public int CompareTo(MassMomentOfInertia other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MassMomentOfInertia objMassMomentOfInertia)) + if (obj is null || !(obj is MassMomentOfInertia objMassMomentOfInertia)) return false; return Equals(objMassMomentOfInertia); @@ -1054,7 +1053,7 @@ public bool Equals(MassMomentOfInertia other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MassMomentOfInertia other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1082,7 +1081,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MassMomentOfInertiaUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1092,13 +1091,13 @@ public double As(MassMomentOfInertiaUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1107,7 +1106,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is MassMomentOfInertiaUnit unitAsMassMomentOfInertiaUnit)) + if (!(unit is MassMomentOfInertiaUnit unitAsMassMomentOfInertiaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassMomentOfInertiaUnit)} is supported.", nameof(unit)); return As(unitAsMassMomentOfInertiaUnit); @@ -1131,18 +1130,18 @@ public MassMomentOfInertia ToUnit(MassMomentOfInertiaUnit unit) /// A MassMomentOfInertia with the specified unit. public MassMomentOfInertia ToUnit(MassMomentOfInertiaUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(MassMomentOfInertia), Unit, typeof(MassMomentOfInertia), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(MassMomentOfInertia), Unit, typeof(MassMomentOfInertia), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (MassMomentOfInertia)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1157,7 +1156,7 @@ public MassMomentOfInertia ToUnit(MassMomentOfInertiaUnit unit, UnitConverter un /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is MassMomentOfInertiaUnit unitAsMassMomentOfInertiaUnit)) + if (!(unit is MassMomentOfInertiaUnit unitAsMassMomentOfInertiaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassMomentOfInertiaUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMassMomentOfInertiaUnit, DefaultConversionFunctions); @@ -1166,7 +1165,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is MassMomentOfInertiaUnit unitAsMassMomentOfInertiaUnit)) + if (!(unit is MassMomentOfInertiaUnit unitAsMassMomentOfInertiaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassMomentOfInertiaUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMassMomentOfInertiaUnit, unitConverter); @@ -1175,13 +1174,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public MassMomentOfInertia ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1356,15 +1355,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MassMomentOfInertia)) + if (conversionType == typeof(MassMomentOfInertia)) return this; - else if(conversionType == typeof(MassMomentOfInertiaUnit)) + else if (conversionType == typeof(MassMomentOfInertiaUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return MassMomentOfInertia.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return MassMomentOfInertia.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return MassMomentOfInertia.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs index f5cfaed6da..0a1306b2b6 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs @@ -81,7 +81,7 @@ static MolarEnergy() /// If value is NaN or Infinity. public MolarEnergy(double value, MolarEnergyUnit unit) { - if(unit == MolarEnergyUnit.Undefined) + if (unit == MolarEnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -98,7 +98,7 @@ public MolarEnergy(double value, MolarEnergyUnit unit) /// No unit was found for the given . public MolarEnergy(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -218,7 +218,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) // Register in unit converter: BaseUnit -> MolarEnergyUnit unitConverter.SetConversionFunction(MolarEnergyUnit.JoulePerMole, MolarEnergyUnit.KilojoulePerMole, quantity => new MolarEnergy((quantity.Value) / 1e3d, MolarEnergyUnit.KilojoulePerMole)); unitConverter.SetConversionFunction(MolarEnergyUnit.JoulePerMole, MolarEnergyUnit.MegajoulePerMole, quantity => new MolarEnergy((quantity.Value) / 1e6d, MolarEnergyUnit.MegajoulePerMole)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(MolarEnergyUnit.JoulePerMole, MolarEnergyUnit.JoulePerMole, quantity => quantity); @@ -533,8 +532,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Molar /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarEnergy objMolarEnergy)) throw new ArgumentException("Expected type MolarEnergy.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MolarEnergy objMolarEnergy)) throw new ArgumentException("Expected type MolarEnergy.", nameof(obj)); return CompareTo(objMolarEnergy); } @@ -549,7 +548,7 @@ public int CompareTo(MolarEnergy other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MolarEnergy objMolarEnergy)) + if (obj is null || !(obj is MolarEnergy objMolarEnergy)) return false; return Equals(objMolarEnergy); @@ -604,7 +603,7 @@ public bool Equals(MolarEnergy other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MolarEnergy other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -632,7 +631,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MolarEnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -642,13 +641,13 @@ public double As(MolarEnergyUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -657,7 +656,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is MolarEnergyUnit unitAsMolarEnergyUnit)) + if (!(unit is MolarEnergyUnit unitAsMolarEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarEnergyUnit)} is supported.", nameof(unit)); return As(unitAsMolarEnergyUnit); @@ -681,18 +680,18 @@ public MolarEnergy ToUnit(MolarEnergyUnit unit) /// A MolarEnergy with the specified unit. public MolarEnergy ToUnit(MolarEnergyUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(MolarEnergy), Unit, typeof(MolarEnergy), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(MolarEnergy), Unit, typeof(MolarEnergy), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (MolarEnergy)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -707,7 +706,7 @@ public MolarEnergy ToUnit(MolarEnergyUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is MolarEnergyUnit unitAsMolarEnergyUnit)) + if (!(unit is MolarEnergyUnit unitAsMolarEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarEnergyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMolarEnergyUnit, DefaultConversionFunctions); @@ -716,7 +715,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is MolarEnergyUnit unitAsMolarEnergyUnit)) + if (!(unit is MolarEnergyUnit unitAsMolarEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarEnergyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMolarEnergyUnit, unitConverter); @@ -725,13 +724,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public MolarEnergy ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -906,15 +905,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MolarEnergy)) + if (conversionType == typeof(MolarEnergy)) return this; - else if(conversionType == typeof(MolarEnergyUnit)) + else if (conversionType == typeof(MolarEnergyUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return MolarEnergy.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return MolarEnergy.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return MolarEnergy.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs index 4578687863..7f3cb1d772 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs @@ -81,7 +81,7 @@ static MolarEntropy() /// If value is NaN or Infinity. public MolarEntropy(double value, MolarEntropyUnit unit) { - if(unit == MolarEntropyUnit.Undefined) + if (unit == MolarEntropyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -98,7 +98,7 @@ public MolarEntropy(double value, MolarEntropyUnit unit) /// No unit was found for the given . public MolarEntropy(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -218,7 +218,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) // Register in unit converter: BaseUnit -> MolarEntropyUnit unitConverter.SetConversionFunction(MolarEntropyUnit.JoulePerMoleKelvin, MolarEntropyUnit.KilojoulePerMoleKelvin, quantity => new MolarEntropy((quantity.Value) / 1e3d, MolarEntropyUnit.KilojoulePerMoleKelvin)); unitConverter.SetConversionFunction(MolarEntropyUnit.JoulePerMoleKelvin, MolarEntropyUnit.MegajoulePerMoleKelvin, quantity => new MolarEntropy((quantity.Value) / 1e6d, MolarEntropyUnit.MegajoulePerMoleKelvin)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(MolarEntropyUnit.JoulePerMoleKelvin, MolarEntropyUnit.JoulePerMoleKelvin, quantity => quantity); @@ -533,8 +532,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Molar /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarEntropy objMolarEntropy)) throw new ArgumentException("Expected type MolarEntropy.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MolarEntropy objMolarEntropy)) throw new ArgumentException("Expected type MolarEntropy.", nameof(obj)); return CompareTo(objMolarEntropy); } @@ -549,7 +548,7 @@ public int CompareTo(MolarEntropy other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MolarEntropy objMolarEntropy)) + if (obj is null || !(obj is MolarEntropy objMolarEntropy)) return false; return Equals(objMolarEntropy); @@ -604,7 +603,7 @@ public bool Equals(MolarEntropy other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MolarEntropy other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -632,7 +631,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MolarEntropyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -642,13 +641,13 @@ public double As(MolarEntropyUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -657,7 +656,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is MolarEntropyUnit unitAsMolarEntropyUnit)) + if (!(unit is MolarEntropyUnit unitAsMolarEntropyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarEntropyUnit)} is supported.", nameof(unit)); return As(unitAsMolarEntropyUnit); @@ -681,18 +680,18 @@ public MolarEntropy ToUnit(MolarEntropyUnit unit) /// A MolarEntropy with the specified unit. public MolarEntropy ToUnit(MolarEntropyUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(MolarEntropy), Unit, typeof(MolarEntropy), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(MolarEntropy), Unit, typeof(MolarEntropy), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (MolarEntropy)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -707,7 +706,7 @@ public MolarEntropy ToUnit(MolarEntropyUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is MolarEntropyUnit unitAsMolarEntropyUnit)) + if (!(unit is MolarEntropyUnit unitAsMolarEntropyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarEntropyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMolarEntropyUnit, DefaultConversionFunctions); @@ -716,7 +715,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is MolarEntropyUnit unitAsMolarEntropyUnit)) + if (!(unit is MolarEntropyUnit unitAsMolarEntropyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarEntropyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMolarEntropyUnit, unitConverter); @@ -725,13 +724,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public MolarEntropy ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -906,15 +905,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MolarEntropy)) + if (conversionType == typeof(MolarEntropy)) return this; - else if(conversionType == typeof(MolarEntropyUnit)) + else if (conversionType == typeof(MolarEntropyUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return MolarEntropy.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return MolarEntropy.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return MolarEntropy.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs index 8e03935a62..475ec43c6c 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs @@ -90,7 +90,7 @@ static MolarMass() /// If value is NaN or Infinity. public MolarMass(double value, MolarMassUnit unit) { - if(unit == MolarMassUnit.Undefined) + if (unit == MolarMassUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -107,7 +107,7 @@ public MolarMass(double value, MolarMassUnit unit) /// No unit was found for the given . public MolarMass(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -281,7 +281,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(MolarMassUnit.KilogramPerMole, MolarMassUnit.MilligramPerMole, quantity => new MolarMass((quantity.Value*1e3) / 1e-3d, MolarMassUnit.MilligramPerMole)); unitConverter.SetConversionFunction(MolarMassUnit.KilogramPerMole, MolarMassUnit.NanogramPerMole, quantity => new MolarMass((quantity.Value*1e3) / 1e-9d, MolarMassUnit.NanogramPerMole)); unitConverter.SetConversionFunction(MolarMassUnit.KilogramPerMole, MolarMassUnit.PoundPerMole, quantity => new MolarMass(quantity.Value/0.45359237, MolarMassUnit.PoundPerMole)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(MolarMassUnit.KilogramPerMole, MolarMassUnit.KilogramPerMole, quantity => quantity); @@ -707,8 +706,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Molar /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarMass objMolarMass)) throw new ArgumentException("Expected type MolarMass.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is MolarMass objMolarMass)) throw new ArgumentException("Expected type MolarMass.", nameof(obj)); return CompareTo(objMolarMass); } @@ -723,7 +722,7 @@ public int CompareTo(MolarMass other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is MolarMass objMolarMass)) + if (obj is null || !(obj is MolarMass objMolarMass)) return false; return Equals(objMolarMass); @@ -778,7 +777,7 @@ public bool Equals(MolarMass other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(MolarMass other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -806,7 +805,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MolarMassUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -816,13 +815,13 @@ public double As(MolarMassUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -831,7 +830,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is MolarMassUnit unitAsMolarMassUnit)) + if (!(unit is MolarMassUnit unitAsMolarMassUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarMassUnit)} is supported.", nameof(unit)); return As(unitAsMolarMassUnit); @@ -855,18 +854,18 @@ public MolarMass ToUnit(MolarMassUnit unit) /// A MolarMass with the specified unit. public MolarMass ToUnit(MolarMassUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(MolarMass), Unit, typeof(MolarMass), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(MolarMass), Unit, typeof(MolarMass), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (MolarMass)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -881,7 +880,7 @@ public MolarMass ToUnit(MolarMassUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is MolarMassUnit unitAsMolarMassUnit)) + if (!(unit is MolarMassUnit unitAsMolarMassUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarMassUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMolarMassUnit, DefaultConversionFunctions); @@ -890,7 +889,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is MolarMassUnit unitAsMolarMassUnit)) + if (!(unit is MolarMassUnit unitAsMolarMassUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarMassUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMolarMassUnit, unitConverter); @@ -899,13 +898,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public MolarMass ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1080,15 +1079,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(MolarMass)) + if (conversionType == typeof(MolarMass)) return this; - else if(conversionType == typeof(MolarMassUnit)) + else if (conversionType == typeof(MolarMassUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return MolarMass.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return MolarMass.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return MolarMass.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(MolarMass)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs index 00e1c633f3..c95242c277 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs @@ -97,7 +97,7 @@ static Molarity() /// If value is NaN or Infinity. public Molarity(double value, MolarityUnit unit) { - if(unit == MolarityUnit.Undefined) + if (unit == MolarityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -114,7 +114,7 @@ public Molarity(double value, MolarityUnit unit) /// No unit was found for the given . public Molarity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -272,7 +272,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(MolarityUnit.MolesPerCubicMeter, MolarityUnit.NanomolesPerLiter, quantity => new Molarity((quantity.Value * 1e-3) / 1e-9d, MolarityUnit.NanomolesPerLiter)); unitConverter.SetConversionFunction(MolarityUnit.MolesPerCubicMeter, MolarityUnit.PicomolePerLiter, quantity => new Molarity((quantity.Value * 1e-3) / 1e-12d, MolarityUnit.PicomolePerLiter)); unitConverter.SetConversionFunction(MolarityUnit.MolesPerCubicMeter, MolarityUnit.PicomolesPerLiter, quantity => new Molarity((quantity.Value * 1e-3) / 1e-12d, MolarityUnit.PicomolesPerLiter)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(MolarityUnit.MolesPerCubicMeter, MolarityUnit.MolesPerCubicMeter, quantity => quantity); @@ -658,8 +657,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Molar /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Molarity objMolarity)) throw new ArgumentException("Expected type Molarity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Molarity objMolarity)) throw new ArgumentException("Expected type Molarity.", nameof(obj)); return CompareTo(objMolarity); } @@ -674,7 +673,7 @@ public int CompareTo(Molarity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Molarity objMolarity)) + if (obj is null || !(obj is Molarity objMolarity)) return false; return Equals(objMolarity); @@ -729,7 +728,7 @@ public bool Equals(Molarity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Molarity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -757,7 +756,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(MolarityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -767,13 +766,13 @@ public double As(MolarityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -782,7 +781,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is MolarityUnit unitAsMolarityUnit)) + if (!(unit is MolarityUnit unitAsMolarityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarityUnit)} is supported.", nameof(unit)); return As(unitAsMolarityUnit); @@ -806,18 +805,18 @@ public Molarity ToUnit(MolarityUnit unit) /// A Molarity with the specified unit. public Molarity ToUnit(MolarityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Molarity), Unit, typeof(Molarity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Molarity), Unit, typeof(Molarity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Molarity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -832,7 +831,7 @@ public Molarity ToUnit(MolarityUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is MolarityUnit unitAsMolarityUnit)) + if (!(unit is MolarityUnit unitAsMolarityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMolarityUnit, DefaultConversionFunctions); @@ -841,7 +840,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is MolarityUnit unitAsMolarityUnit)) + if (!(unit is MolarityUnit unitAsMolarityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsMolarityUnit, unitConverter); @@ -850,13 +849,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Molarity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1031,15 +1030,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Molarity)) + if (conversionType == typeof(Molarity)) return this; - else if(conversionType == typeof(MolarityUnit)) + else if (conversionType == typeof(MolarityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Molarity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Molarity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Molarity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Molarity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs index 7996608265..a98486a118 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs @@ -82,7 +82,7 @@ static Permeability() /// If value is NaN or Infinity. public Permeability(double value, PermeabilityUnit unit) { - if(unit == PermeabilityUnit.Undefined) + if (unit == PermeabilityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public Permeability(double value, PermeabilityUnit unit) /// No unit was found for the given . public Permeability(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -207,7 +207,6 @@ public Permeability(double value, UnitSystem unitSystem) internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> PermeabilityUnit - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(PermeabilityUnit.HenryPerMeter, PermeabilityUnit.HenryPerMeter, quantity => quantity); @@ -500,8 +499,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Perme /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Permeability objPermeability)) throw new ArgumentException("Expected type Permeability.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Permeability objPermeability)) throw new ArgumentException("Expected type Permeability.", nameof(obj)); return CompareTo(objPermeability); } @@ -516,7 +515,7 @@ public int CompareTo(Permeability other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Permeability objPermeability)) + if (obj is null || !(obj is Permeability objPermeability)) return false; return Equals(objPermeability); @@ -571,7 +570,7 @@ public bool Equals(Permeability other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Permeability other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -599,7 +598,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(PermeabilityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -609,13 +608,13 @@ public double As(PermeabilityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -624,7 +623,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is PermeabilityUnit unitAsPermeabilityUnit)) + if (!(unit is PermeabilityUnit unitAsPermeabilityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PermeabilityUnit)} is supported.", nameof(unit)); return As(unitAsPermeabilityUnit); @@ -648,18 +647,18 @@ public Permeability ToUnit(PermeabilityUnit unit) /// A Permeability with the specified unit. public Permeability ToUnit(PermeabilityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Permeability), Unit, typeof(Permeability), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Permeability), Unit, typeof(Permeability), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Permeability)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -674,7 +673,7 @@ public Permeability ToUnit(PermeabilityUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is PermeabilityUnit unitAsPermeabilityUnit)) + if (!(unit is PermeabilityUnit unitAsPermeabilityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PermeabilityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsPermeabilityUnit, DefaultConversionFunctions); @@ -683,7 +682,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is PermeabilityUnit unitAsPermeabilityUnit)) + if (!(unit is PermeabilityUnit unitAsPermeabilityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PermeabilityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsPermeabilityUnit, unitConverter); @@ -692,13 +691,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Permeability ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -873,15 +872,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Permeability)) + if (conversionType == typeof(Permeability)) return this; - else if(conversionType == typeof(PermeabilityUnit)) + else if (conversionType == typeof(PermeabilityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Permeability.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Permeability.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Permeability.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Permeability)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs index 8f976e413c..ce56e6f38e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs @@ -82,7 +82,7 @@ static Permittivity() /// If value is NaN or Infinity. public Permittivity(double value, PermittivityUnit unit) { - if(unit == PermittivityUnit.Undefined) + if (unit == PermittivityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public Permittivity(double value, PermittivityUnit unit) /// No unit was found for the given . public Permittivity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -207,7 +207,6 @@ public Permittivity(double value, UnitSystem unitSystem) internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> PermittivityUnit - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(PermittivityUnit.FaradPerMeter, PermittivityUnit.FaradPerMeter, quantity => quantity); @@ -500,8 +499,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Permi /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Permittivity objPermittivity)) throw new ArgumentException("Expected type Permittivity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Permittivity objPermittivity)) throw new ArgumentException("Expected type Permittivity.", nameof(obj)); return CompareTo(objPermittivity); } @@ -516,7 +515,7 @@ public int CompareTo(Permittivity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Permittivity objPermittivity)) + if (obj is null || !(obj is Permittivity objPermittivity)) return false; return Equals(objPermittivity); @@ -571,7 +570,7 @@ public bool Equals(Permittivity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Permittivity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -599,7 +598,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(PermittivityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -609,13 +608,13 @@ public double As(PermittivityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -624,7 +623,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is PermittivityUnit unitAsPermittivityUnit)) + if (!(unit is PermittivityUnit unitAsPermittivityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PermittivityUnit)} is supported.", nameof(unit)); return As(unitAsPermittivityUnit); @@ -648,18 +647,18 @@ public Permittivity ToUnit(PermittivityUnit unit) /// A Permittivity with the specified unit. public Permittivity ToUnit(PermittivityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Permittivity), Unit, typeof(Permittivity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Permittivity), Unit, typeof(Permittivity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Permittivity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -674,7 +673,7 @@ public Permittivity ToUnit(PermittivityUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is PermittivityUnit unitAsPermittivityUnit)) + if (!(unit is PermittivityUnit unitAsPermittivityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PermittivityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsPermittivityUnit, DefaultConversionFunctions); @@ -683,7 +682,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is PermittivityUnit unitAsPermittivityUnit)) + if (!(unit is PermittivityUnit unitAsPermittivityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PermittivityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsPermittivityUnit, unitConverter); @@ -692,13 +691,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Permittivity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -873,15 +872,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Permittivity)) + if (conversionType == typeof(Permittivity)) return this; - else if(conversionType == typeof(PermittivityUnit)) + else if (conversionType == typeof(PermittivityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Permittivity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Permittivity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Permittivity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Permittivity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Power.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.g.cs index 6f1161d230..f2b2be465e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.g.cs @@ -103,7 +103,7 @@ static Power() /// If value is NaN or Infinity. public Power(decimal value, PowerUnit unit) { - if(unit == PowerUnit.Undefined) + if (unit == PowerUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = value; @@ -120,7 +120,7 @@ public Power(decimal value, PowerUnit unit) /// No unit was found for the given . public Power(decimal value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -377,7 +377,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.Petawatt, quantity => new Power((quantity.Value) / 1e15m, PowerUnit.Petawatt)); unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.Picowatt, quantity => new Power((quantity.Value) / 1e-12m, PowerUnit.Picowatt)); unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.Terawatt, quantity => new Power((quantity.Value) / 1e12m, PowerUnit.Terawatt)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.Watt, quantity => quantity); @@ -934,8 +933,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Power /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Power objPower)) throw new ArgumentException("Expected type Power.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Power objPower)) throw new ArgumentException("Expected type Power.", nameof(obj)); return CompareTo(objPower); } @@ -950,7 +949,7 @@ public int CompareTo(Power other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Power objPower)) + if (obj is null || !(obj is Power objPower)) return false; return Equals(objPower); @@ -1005,7 +1004,7 @@ public bool Equals(Power other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Power other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1033,7 +1032,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(PowerUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1043,13 +1042,13 @@ public double As(PowerUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1058,7 +1057,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is PowerUnit unitAsPowerUnit)) + if (!(unit is PowerUnit unitAsPowerUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PowerUnit)} is supported.", nameof(unit)); return As(unitAsPowerUnit); @@ -1082,18 +1081,18 @@ public Power ToUnit(PowerUnit unit) /// A Power with the specified unit. public Power ToUnit(PowerUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Power), Unit, typeof(Power), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Power), Unit, typeof(Power), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Power)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1108,7 +1107,7 @@ public Power ToUnit(PowerUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is PowerUnit unitAsPowerUnit)) + if (!(unit is PowerUnit unitAsPowerUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PowerUnit)} is supported.", nameof(unit)); return ToUnit(unitAsPowerUnit, DefaultConversionFunctions); @@ -1117,7 +1116,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is PowerUnit unitAsPowerUnit)) + if (!(unit is PowerUnit unitAsPowerUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PowerUnit)} is supported.", nameof(unit)); return ToUnit(unitAsPowerUnit, unitConverter); @@ -1126,13 +1125,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Power ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1307,15 +1306,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Power)) + if (conversionType == typeof(Power)) return this; - else if(conversionType == typeof(PowerUnit)) + else if (conversionType == typeof(PowerUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Power.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Power.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Power.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Power)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs index ad14be906d..bc57c44007 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs @@ -122,7 +122,7 @@ static PowerDensity() /// If value is NaN or Infinity. public PowerDensity(double value, PowerDensityUnit unit) { - if(unit == PowerDensityUnit.Undefined) + if (unit == PowerDensityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -139,7 +139,7 @@ public PowerDensity(double value, PowerDensityUnit unit) /// No unit was found for the given . public PowerDensity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -505,7 +505,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(PowerDensityUnit.WattPerCubicMeter, PowerDensityUnit.WattPerCubicFoot, quantity => new PowerDensity(quantity.Value/3.531466672148859e1, PowerDensityUnit.WattPerCubicFoot)); unitConverter.SetConversionFunction(PowerDensityUnit.WattPerCubicMeter, PowerDensityUnit.WattPerCubicInch, quantity => new PowerDensity(quantity.Value/6.102374409473228e4, PowerDensityUnit.WattPerCubicInch)); unitConverter.SetConversionFunction(PowerDensityUnit.WattPerCubicMeter, PowerDensityUnit.WattPerLiter, quantity => new PowerDensity(quantity.Value/1.0e3, PowerDensityUnit.WattPerLiter)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(PowerDensityUnit.WattPerCubicMeter, PowerDensityUnit.WattPerCubicMeter, quantity => quantity); @@ -1271,8 +1270,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Power /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PowerDensity objPowerDensity)) throw new ArgumentException("Expected type PowerDensity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is PowerDensity objPowerDensity)) throw new ArgumentException("Expected type PowerDensity.", nameof(obj)); return CompareTo(objPowerDensity); } @@ -1287,7 +1286,7 @@ public int CompareTo(PowerDensity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is PowerDensity objPowerDensity)) + if (obj is null || !(obj is PowerDensity objPowerDensity)) return false; return Equals(objPowerDensity); @@ -1342,7 +1341,7 @@ public bool Equals(PowerDensity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(PowerDensity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1370,7 +1369,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(PowerDensityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1380,13 +1379,13 @@ public double As(PowerDensityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1395,7 +1394,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is PowerDensityUnit unitAsPowerDensityUnit)) + if (!(unit is PowerDensityUnit unitAsPowerDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PowerDensityUnit)} is supported.", nameof(unit)); return As(unitAsPowerDensityUnit); @@ -1419,18 +1418,18 @@ public PowerDensity ToUnit(PowerDensityUnit unit) /// A PowerDensity with the specified unit. public PowerDensity ToUnit(PowerDensityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(PowerDensity), Unit, typeof(PowerDensity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(PowerDensity), Unit, typeof(PowerDensity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (PowerDensity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1445,7 +1444,7 @@ public PowerDensity ToUnit(PowerDensityUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is PowerDensityUnit unitAsPowerDensityUnit)) + if (!(unit is PowerDensityUnit unitAsPowerDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PowerDensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsPowerDensityUnit, DefaultConversionFunctions); @@ -1454,7 +1453,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is PowerDensityUnit unitAsPowerDensityUnit)) + if (!(unit is PowerDensityUnit unitAsPowerDensityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PowerDensityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsPowerDensityUnit, unitConverter); @@ -1463,13 +1462,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public PowerDensity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1644,15 +1643,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(PowerDensity)) + if (conversionType == typeof(PowerDensity)) return this; - else if(conversionType == typeof(PowerDensityUnit)) + else if (conversionType == typeof(PowerDensityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return PowerDensity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return PowerDensity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return PowerDensity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(PowerDensity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs index 5194100a66..c457557804 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs @@ -80,7 +80,7 @@ static PowerRatio() /// If value is NaN or Infinity. public PowerRatio(double value, PowerRatioUnit unit) { - if(unit == PowerRatioUnit.Undefined) + if (unit == PowerRatioUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -97,7 +97,7 @@ public PowerRatio(double value, PowerRatioUnit unit) /// No unit was found for the given . public PowerRatio(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -211,7 +211,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> PowerRatioUnit unitConverter.SetConversionFunction(PowerRatioUnit.DecibelWatt, PowerRatioUnit.DecibelMilliwatt, quantity => new PowerRatio(quantity.Value + 30, PowerRatioUnit.DecibelMilliwatt)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(PowerRatioUnit.DecibelWatt, PowerRatioUnit.DecibelWatt, quantity => quantity); @@ -523,8 +522,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Power /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PowerRatio objPowerRatio)) throw new ArgumentException("Expected type PowerRatio.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is PowerRatio objPowerRatio)) throw new ArgumentException("Expected type PowerRatio.", nameof(obj)); return CompareTo(objPowerRatio); } @@ -539,7 +538,7 @@ public int CompareTo(PowerRatio other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is PowerRatio objPowerRatio)) + if (obj is null || !(obj is PowerRatio objPowerRatio)) return false; return Equals(objPowerRatio); @@ -594,7 +593,7 @@ public bool Equals(PowerRatio other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(PowerRatio other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -622,7 +621,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(PowerRatioUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -632,13 +631,13 @@ public double As(PowerRatioUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -647,7 +646,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is PowerRatioUnit unitAsPowerRatioUnit)) + if (!(unit is PowerRatioUnit unitAsPowerRatioUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PowerRatioUnit)} is supported.", nameof(unit)); return As(unitAsPowerRatioUnit); @@ -671,18 +670,18 @@ public PowerRatio ToUnit(PowerRatioUnit unit) /// A PowerRatio with the specified unit. public PowerRatio ToUnit(PowerRatioUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(PowerRatio), Unit, typeof(PowerRatio), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(PowerRatio), Unit, typeof(PowerRatio), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (PowerRatio)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -697,7 +696,7 @@ public PowerRatio ToUnit(PowerRatioUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is PowerRatioUnit unitAsPowerRatioUnit)) + if (!(unit is PowerRatioUnit unitAsPowerRatioUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PowerRatioUnit)} is supported.", nameof(unit)); return ToUnit(unitAsPowerRatioUnit, DefaultConversionFunctions); @@ -706,7 +705,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is PowerRatioUnit unitAsPowerRatioUnit)) + if (!(unit is PowerRatioUnit unitAsPowerRatioUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PowerRatioUnit)} is supported.", nameof(unit)); return ToUnit(unitAsPowerRatioUnit, unitConverter); @@ -715,13 +714,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public PowerRatio ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -896,15 +895,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(PowerRatio)) + if (conversionType == typeof(PowerRatio)) return this; - else if(conversionType == typeof(PowerRatioUnit)) + else if (conversionType == typeof(PowerRatioUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return PowerRatio.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return PowerRatio.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return PowerRatio.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(PowerRatio)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs index 8f3789c9d2..1b3b9584b0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs @@ -123,7 +123,7 @@ static Pressure() /// If value is NaN or Infinity. public Pressure(double value, PressureUnit unit) { - if(unit == PressureUnit.Undefined) + if (unit == PressureUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -140,7 +140,7 @@ public Pressure(double value, PressureUnit unit) /// No unit was found for the given . public Pressure(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -512,7 +512,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(PressureUnit.Pascal, PressureUnit.TonneForcePerSquareMeter, quantity => new Pressure(quantity.Value/9.80665e3, PressureUnit.TonneForcePerSquareMeter)); unitConverter.SetConversionFunction(PressureUnit.Pascal, PressureUnit.TonneForcePerSquareMillimeter, quantity => new Pressure(quantity.Value/9.80665e9, PressureUnit.TonneForcePerSquareMillimeter)); unitConverter.SetConversionFunction(PressureUnit.Pascal, PressureUnit.Torr, quantity => new Pressure(quantity.Value/(1.3332266752*1e2), PressureUnit.Torr)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(PressureUnit.Pascal, PressureUnit.Pascal, quantity => quantity); @@ -1320,8 +1319,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Press /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Pressure objPressure)) throw new ArgumentException("Expected type Pressure.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Pressure objPressure)) throw new ArgumentException("Expected type Pressure.", nameof(obj)); return CompareTo(objPressure); } @@ -1336,7 +1335,7 @@ public int CompareTo(Pressure other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Pressure objPressure)) + if (obj is null || !(obj is Pressure objPressure)) return false; return Equals(objPressure); @@ -1391,7 +1390,7 @@ public bool Equals(Pressure other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Pressure other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1419,7 +1418,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(PressureUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1429,13 +1428,13 @@ public double As(PressureUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1444,7 +1443,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is PressureUnit unitAsPressureUnit)) + if (!(unit is PressureUnit unitAsPressureUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PressureUnit)} is supported.", nameof(unit)); return As(unitAsPressureUnit); @@ -1468,18 +1467,18 @@ public Pressure ToUnit(PressureUnit unit) /// A Pressure with the specified unit. public Pressure ToUnit(PressureUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Pressure), Unit, typeof(Pressure), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Pressure), Unit, typeof(Pressure), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Pressure)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1494,7 +1493,7 @@ public Pressure ToUnit(PressureUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is PressureUnit unitAsPressureUnit)) + if (!(unit is PressureUnit unitAsPressureUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PressureUnit)} is supported.", nameof(unit)); return ToUnit(unitAsPressureUnit, DefaultConversionFunctions); @@ -1503,7 +1502,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is PressureUnit unitAsPressureUnit)) + if (!(unit is PressureUnit unitAsPressureUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PressureUnit)} is supported.", nameof(unit)); return ToUnit(unitAsPressureUnit, unitConverter); @@ -1512,13 +1511,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Pressure ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1693,15 +1692,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Pressure)) + if (conversionType == typeof(Pressure)) return this; - else if(conversionType == typeof(PressureUnit)) + else if (conversionType == typeof(PressureUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Pressure.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Pressure.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Pressure.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Pressure)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs index 91e2be95bd..453e1a1fd2 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -92,7 +92,7 @@ static PressureChangeRate() /// If value is NaN or Infinity. public PressureChangeRate(double value, PressureChangeRateUnit unit) { - if(unit == PressureChangeRateUnit.Undefined) + if (unit == PressureChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -109,7 +109,7 @@ public PressureChangeRate(double value, PressureChangeRateUnit unit) /// No unit was found for the given . public PressureChangeRate(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -295,7 +295,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(PressureChangeRateUnit.PascalPerSecond, PressureChangeRateUnit.PascalPerMinute, quantity => new PressureChangeRate(quantity.Value*60, PressureChangeRateUnit.PascalPerMinute)); unitConverter.SetConversionFunction(PressureChangeRateUnit.PascalPerSecond, PressureChangeRateUnit.PoundForcePerSquareInchPerMinute, quantity => new PressureChangeRate(quantity.Value/6.894757293168361e3*60, PressureChangeRateUnit.PoundForcePerSquareInchPerMinute)); unitConverter.SetConversionFunction(PressureChangeRateUnit.PascalPerSecond, PressureChangeRateUnit.PoundForcePerSquareInchPerSecond, quantity => new PressureChangeRate(quantity.Value/6.894757293168361e3, PressureChangeRateUnit.PoundForcePerSquareInchPerSecond)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(PressureChangeRateUnit.PascalPerSecond, PressureChangeRateUnit.PascalPerSecond, quantity => quantity); @@ -745,8 +744,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Press /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PressureChangeRate objPressureChangeRate)) throw new ArgumentException("Expected type PressureChangeRate.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is PressureChangeRate objPressureChangeRate)) throw new ArgumentException("Expected type PressureChangeRate.", nameof(obj)); return CompareTo(objPressureChangeRate); } @@ -761,7 +760,7 @@ public int CompareTo(PressureChangeRate other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is PressureChangeRate objPressureChangeRate)) + if (obj is null || !(obj is PressureChangeRate objPressureChangeRate)) return false; return Equals(objPressureChangeRate); @@ -816,7 +815,7 @@ public bool Equals(PressureChangeRate other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(PressureChangeRate other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -844,7 +843,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(PressureChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -854,13 +853,13 @@ public double As(PressureChangeRateUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -869,7 +868,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is PressureChangeRateUnit unitAsPressureChangeRateUnit)) + if (!(unit is PressureChangeRateUnit unitAsPressureChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PressureChangeRateUnit)} is supported.", nameof(unit)); return As(unitAsPressureChangeRateUnit); @@ -893,18 +892,18 @@ public PressureChangeRate ToUnit(PressureChangeRateUnit unit) /// A PressureChangeRate with the specified unit. public PressureChangeRate ToUnit(PressureChangeRateUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(PressureChangeRate), Unit, typeof(PressureChangeRate), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(PressureChangeRate), Unit, typeof(PressureChangeRate), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (PressureChangeRate)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -919,7 +918,7 @@ public PressureChangeRate ToUnit(PressureChangeRateUnit unit, UnitConverter unit /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is PressureChangeRateUnit unitAsPressureChangeRateUnit)) + if (!(unit is PressureChangeRateUnit unitAsPressureChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PressureChangeRateUnit)} is supported.", nameof(unit)); return ToUnit(unitAsPressureChangeRateUnit, DefaultConversionFunctions); @@ -928,7 +927,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is PressureChangeRateUnit unitAsPressureChangeRateUnit)) + if (!(unit is PressureChangeRateUnit unitAsPressureChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PressureChangeRateUnit)} is supported.", nameof(unit)); return ToUnit(unitAsPressureChangeRateUnit, unitConverter); @@ -937,13 +936,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public PressureChangeRate ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1118,15 +1117,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(PressureChangeRate)) + if (conversionType == typeof(PressureChangeRate)) return this; - else if(conversionType == typeof(PressureChangeRateUnit)) + else if (conversionType == typeof(PressureChangeRateUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return PressureChangeRate.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return PressureChangeRate.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return PressureChangeRate.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs index 7e89ef0db8..da39569752 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs @@ -84,7 +84,7 @@ static Ratio() /// If value is NaN or Infinity. public Ratio(double value, RatioUnit unit) { - if(unit == RatioUnit.Undefined) + if (unit == RatioUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -101,7 +101,7 @@ public Ratio(double value, RatioUnit unit) /// No unit was found for the given . public Ratio(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -239,7 +239,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(RatioUnit.DecimalFraction, RatioUnit.PartPerThousand, quantity => new Ratio(quantity.Value*1e3, RatioUnit.PartPerThousand)); unitConverter.SetConversionFunction(RatioUnit.DecimalFraction, RatioUnit.PartPerTrillion, quantity => new Ratio(quantity.Value*1e12, RatioUnit.PartPerTrillion)); unitConverter.SetConversionFunction(RatioUnit.DecimalFraction, RatioUnit.Percent, quantity => new Ratio(quantity.Value*1e2, RatioUnit.Percent)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(RatioUnit.DecimalFraction, RatioUnit.DecimalFraction, quantity => quantity); @@ -587,8 +586,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Ratio /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Ratio objRatio)) throw new ArgumentException("Expected type Ratio.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Ratio objRatio)) throw new ArgumentException("Expected type Ratio.", nameof(obj)); return CompareTo(objRatio); } @@ -603,7 +602,7 @@ public int CompareTo(Ratio other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Ratio objRatio)) + if (obj is null || !(obj is Ratio objRatio)) return false; return Equals(objRatio); @@ -658,7 +657,7 @@ public bool Equals(Ratio other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Ratio other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -686,7 +685,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(RatioUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -696,13 +695,13 @@ public double As(RatioUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -711,7 +710,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is RatioUnit unitAsRatioUnit)) + if (!(unit is RatioUnit unitAsRatioUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RatioUnit)} is supported.", nameof(unit)); return As(unitAsRatioUnit); @@ -735,18 +734,18 @@ public Ratio ToUnit(RatioUnit unit) /// A Ratio with the specified unit. public Ratio ToUnit(RatioUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Ratio), Unit, typeof(Ratio), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Ratio), Unit, typeof(Ratio), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Ratio)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -761,7 +760,7 @@ public Ratio ToUnit(RatioUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is RatioUnit unitAsRatioUnit)) + if (!(unit is RatioUnit unitAsRatioUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RatioUnit)} is supported.", nameof(unit)); return ToUnit(unitAsRatioUnit, DefaultConversionFunctions); @@ -770,7 +769,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is RatioUnit unitAsRatioUnit)) + if (!(unit is RatioUnit unitAsRatioUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RatioUnit)} is supported.", nameof(unit)); return ToUnit(unitAsRatioUnit, unitConverter); @@ -779,13 +778,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Ratio ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -960,15 +959,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Ratio)) + if (conversionType == typeof(Ratio)) return this; - else if(conversionType == typeof(RatioUnit)) + else if (conversionType == typeof(RatioUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Ratio.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Ratio.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Ratio.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Ratio)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs index e341f1dc8d..7507200653 100644 --- a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs @@ -80,7 +80,7 @@ static RatioChangeRate() /// If value is NaN or Infinity. public RatioChangeRate(double value, RatioChangeRateUnit unit) { - if(unit == RatioChangeRateUnit.Undefined) + if (unit == RatioChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -97,7 +97,7 @@ public RatioChangeRate(double value, RatioChangeRateUnit unit) /// No unit was found for the given . public RatioChangeRate(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -211,7 +211,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> RatioChangeRateUnit unitConverter.SetConversionFunction(RatioChangeRateUnit.DecimalFractionPerSecond, RatioChangeRateUnit.PercentPerSecond, quantity => new RatioChangeRate(quantity.Value*1e2, RatioChangeRateUnit.PercentPerSecond)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(RatioChangeRateUnit.DecimalFractionPerSecond, RatioChangeRateUnit.DecimalFractionPerSecond, quantity => quantity); @@ -515,8 +514,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Ratio /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RatioChangeRate objRatioChangeRate)) throw new ArgumentException("Expected type RatioChangeRate.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is RatioChangeRate objRatioChangeRate)) throw new ArgumentException("Expected type RatioChangeRate.", nameof(obj)); return CompareTo(objRatioChangeRate); } @@ -531,7 +530,7 @@ public int CompareTo(RatioChangeRate other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is RatioChangeRate objRatioChangeRate)) + if (obj is null || !(obj is RatioChangeRate objRatioChangeRate)) return false; return Equals(objRatioChangeRate); @@ -586,7 +585,7 @@ public bool Equals(RatioChangeRate other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(RatioChangeRate other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -614,7 +613,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(RatioChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -624,13 +623,13 @@ public double As(RatioChangeRateUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -639,7 +638,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is RatioChangeRateUnit unitAsRatioChangeRateUnit)) + if (!(unit is RatioChangeRateUnit unitAsRatioChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RatioChangeRateUnit)} is supported.", nameof(unit)); return As(unitAsRatioChangeRateUnit); @@ -663,18 +662,18 @@ public RatioChangeRate ToUnit(RatioChangeRateUnit unit) /// A RatioChangeRate with the specified unit. public RatioChangeRate ToUnit(RatioChangeRateUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(RatioChangeRate), Unit, typeof(RatioChangeRate), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(RatioChangeRate), Unit, typeof(RatioChangeRate), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (RatioChangeRate)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -689,7 +688,7 @@ public RatioChangeRate ToUnit(RatioChangeRateUnit unit, UnitConverter unitConver /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is RatioChangeRateUnit unitAsRatioChangeRateUnit)) + if (!(unit is RatioChangeRateUnit unitAsRatioChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RatioChangeRateUnit)} is supported.", nameof(unit)); return ToUnit(unitAsRatioChangeRateUnit, DefaultConversionFunctions); @@ -698,7 +697,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is RatioChangeRateUnit unitAsRatioChangeRateUnit)) + if (!(unit is RatioChangeRateUnit unitAsRatioChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RatioChangeRateUnit)} is supported.", nameof(unit)); return ToUnit(unitAsRatioChangeRateUnit, unitConverter); @@ -707,13 +706,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public RatioChangeRate ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -888,15 +887,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(RatioChangeRate)) + if (conversionType == typeof(RatioChangeRate)) return this; - else if(conversionType == typeof(RatioChangeRateUnit)) + else if (conversionType == typeof(RatioChangeRateUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return RatioChangeRate.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return RatioChangeRate.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return RatioChangeRate.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(RatioChangeRate)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs index 3791d2a5c8..38e5df7917 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs @@ -81,7 +81,7 @@ static ReactiveEnergy() /// If value is NaN or Infinity. public ReactiveEnergy(double value, ReactiveEnergyUnit unit) { - if(unit == ReactiveEnergyUnit.Undefined) + if (unit == ReactiveEnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -98,7 +98,7 @@ public ReactiveEnergy(double value, ReactiveEnergyUnit unit) /// No unit was found for the given . public ReactiveEnergy(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -218,7 +218,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) // Register in unit converter: BaseUnit -> ReactiveEnergyUnit unitConverter.SetConversionFunction(ReactiveEnergyUnit.VoltampereReactiveHour, ReactiveEnergyUnit.KilovoltampereReactiveHour, quantity => new ReactiveEnergy((quantity.Value) / 1e3d, ReactiveEnergyUnit.KilovoltampereReactiveHour)); unitConverter.SetConversionFunction(ReactiveEnergyUnit.VoltampereReactiveHour, ReactiveEnergyUnit.MegavoltampereReactiveHour, quantity => new ReactiveEnergy((quantity.Value) / 1e6d, ReactiveEnergyUnit.MegavoltampereReactiveHour)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ReactiveEnergyUnit.VoltampereReactiveHour, ReactiveEnergyUnit.VoltampereReactiveHour, quantity => quantity); @@ -533,8 +532,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out React /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ReactiveEnergy objReactiveEnergy)) throw new ArgumentException("Expected type ReactiveEnergy.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ReactiveEnergy objReactiveEnergy)) throw new ArgumentException("Expected type ReactiveEnergy.", nameof(obj)); return CompareTo(objReactiveEnergy); } @@ -549,7 +548,7 @@ public int CompareTo(ReactiveEnergy other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ReactiveEnergy objReactiveEnergy)) + if (obj is null || !(obj is ReactiveEnergy objReactiveEnergy)) return false; return Equals(objReactiveEnergy); @@ -604,7 +603,7 @@ public bool Equals(ReactiveEnergy other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ReactiveEnergy other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -632,7 +631,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ReactiveEnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -642,13 +641,13 @@ public double As(ReactiveEnergyUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -657,7 +656,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ReactiveEnergyUnit unitAsReactiveEnergyUnit)) + if (!(unit is ReactiveEnergyUnit unitAsReactiveEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReactiveEnergyUnit)} is supported.", nameof(unit)); return As(unitAsReactiveEnergyUnit); @@ -681,18 +680,18 @@ public ReactiveEnergy ToUnit(ReactiveEnergyUnit unit) /// A ReactiveEnergy with the specified unit. public ReactiveEnergy ToUnit(ReactiveEnergyUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ReactiveEnergy), Unit, typeof(ReactiveEnergy), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ReactiveEnergy), Unit, typeof(ReactiveEnergy), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ReactiveEnergy)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -707,7 +706,7 @@ public ReactiveEnergy ToUnit(ReactiveEnergyUnit unit, UnitConverter unitConverte /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ReactiveEnergyUnit unitAsReactiveEnergyUnit)) + if (!(unit is ReactiveEnergyUnit unitAsReactiveEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReactiveEnergyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsReactiveEnergyUnit, DefaultConversionFunctions); @@ -716,7 +715,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ReactiveEnergyUnit unitAsReactiveEnergyUnit)) + if (!(unit is ReactiveEnergyUnit unitAsReactiveEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReactiveEnergyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsReactiveEnergyUnit, unitConverter); @@ -725,13 +724,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ReactiveEnergy ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -906,15 +905,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ReactiveEnergy)) + if (conversionType == typeof(ReactiveEnergy)) return this; - else if(conversionType == typeof(ReactiveEnergyUnit)) + else if (conversionType == typeof(ReactiveEnergyUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ReactiveEnergy.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ReactiveEnergy.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ReactiveEnergy.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs index c27e1aa272..d0ed070a1a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs @@ -82,7 +82,7 @@ static ReactivePower() /// If value is NaN or Infinity. public ReactivePower(double value, ReactivePowerUnit unit) { - if(unit == ReactivePowerUnit.Undefined) + if (unit == ReactivePowerUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public ReactivePower(double value, ReactivePowerUnit unit) /// No unit was found for the given . public ReactivePower(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -225,7 +225,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ReactivePowerUnit.VoltampereReactive, ReactivePowerUnit.GigavoltampereReactive, quantity => new ReactivePower((quantity.Value) / 1e9d, ReactivePowerUnit.GigavoltampereReactive)); unitConverter.SetConversionFunction(ReactivePowerUnit.VoltampereReactive, ReactivePowerUnit.KilovoltampereReactive, quantity => new ReactivePower((quantity.Value) / 1e3d, ReactivePowerUnit.KilovoltampereReactive)); unitConverter.SetConversionFunction(ReactivePowerUnit.VoltampereReactive, ReactivePowerUnit.MegavoltampereReactive, quantity => new ReactivePower((quantity.Value) / 1e6d, ReactivePowerUnit.MegavoltampereReactive)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ReactivePowerUnit.VoltampereReactive, ReactivePowerUnit.VoltampereReactive, quantity => quantity); @@ -551,8 +550,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out React /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ReactivePower objReactivePower)) throw new ArgumentException("Expected type ReactivePower.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ReactivePower objReactivePower)) throw new ArgumentException("Expected type ReactivePower.", nameof(obj)); return CompareTo(objReactivePower); } @@ -567,7 +566,7 @@ public int CompareTo(ReactivePower other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ReactivePower objReactivePower)) + if (obj is null || !(obj is ReactivePower objReactivePower)) return false; return Equals(objReactivePower); @@ -622,7 +621,7 @@ public bool Equals(ReactivePower other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ReactivePower other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -650,7 +649,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ReactivePowerUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -660,13 +659,13 @@ public double As(ReactivePowerUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -675,7 +674,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ReactivePowerUnit unitAsReactivePowerUnit)) + if (!(unit is ReactivePowerUnit unitAsReactivePowerUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReactivePowerUnit)} is supported.", nameof(unit)); return As(unitAsReactivePowerUnit); @@ -699,18 +698,18 @@ public ReactivePower ToUnit(ReactivePowerUnit unit) /// A ReactivePower with the specified unit. public ReactivePower ToUnit(ReactivePowerUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ReactivePower), Unit, typeof(ReactivePower), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ReactivePower), Unit, typeof(ReactivePower), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ReactivePower)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -725,7 +724,7 @@ public ReactivePower ToUnit(ReactivePowerUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ReactivePowerUnit unitAsReactivePowerUnit)) + if (!(unit is ReactivePowerUnit unitAsReactivePowerUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReactivePowerUnit)} is supported.", nameof(unit)); return ToUnit(unitAsReactivePowerUnit, DefaultConversionFunctions); @@ -734,7 +733,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ReactivePowerUnit unitAsReactivePowerUnit)) + if (!(unit is ReactivePowerUnit unitAsReactivePowerUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReactivePowerUnit)} is supported.", nameof(unit)); return ToUnit(unitAsReactivePowerUnit, unitConverter); @@ -743,13 +742,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ReactivePower ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -924,15 +923,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ReactivePower)) + if (conversionType == typeof(ReactivePower)) return this; - else if(conversionType == typeof(ReactivePowerUnit)) + else if (conversionType == typeof(ReactivePowerUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ReactivePower.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ReactivePower.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ReactivePower.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ReactivePower)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs index 42ec4e7959..06442fbd92 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs @@ -92,7 +92,7 @@ static ReciprocalArea() /// If value is NaN or Infinity. public ReciprocalArea(double value, ReciprocalAreaUnit unit) { - if(unit == ReciprocalAreaUnit.Undefined) + if (unit == ReciprocalAreaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -109,7 +109,7 @@ public ReciprocalArea(double value, ReciprocalAreaUnit unit) /// No unit was found for the given . public ReciprocalArea(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -277,7 +277,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ReciprocalAreaUnit.InverseSquareMeter, ReciprocalAreaUnit.InverseSquareMillimeter, quantity => new ReciprocalArea(quantity.Value*1e-6, ReciprocalAreaUnit.InverseSquareMillimeter)); unitConverter.SetConversionFunction(ReciprocalAreaUnit.InverseSquareMeter, ReciprocalAreaUnit.InverseSquareYard, quantity => new ReciprocalArea(quantity.Value*0.836127, ReciprocalAreaUnit.InverseSquareYard)); unitConverter.SetConversionFunction(ReciprocalAreaUnit.InverseSquareMeter, ReciprocalAreaUnit.InverseUsSurveySquareFoot, quantity => new ReciprocalArea(quantity.Value*0.09290341161, ReciprocalAreaUnit.InverseUsSurveySquareFoot)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ReciprocalAreaUnit.InverseSquareMeter, ReciprocalAreaUnit.InverseSquareMeter, quantity => quantity); @@ -680,8 +679,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Recip /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ReciprocalArea objReciprocalArea)) throw new ArgumentException("Expected type ReciprocalArea.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ReciprocalArea objReciprocalArea)) throw new ArgumentException("Expected type ReciprocalArea.", nameof(obj)); return CompareTo(objReciprocalArea); } @@ -696,7 +695,7 @@ public int CompareTo(ReciprocalArea other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ReciprocalArea objReciprocalArea)) + if (obj is null || !(obj is ReciprocalArea objReciprocalArea)) return false; return Equals(objReciprocalArea); @@ -751,7 +750,7 @@ public bool Equals(ReciprocalArea other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ReciprocalArea other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -779,7 +778,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ReciprocalAreaUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -789,13 +788,13 @@ public double As(ReciprocalAreaUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -804,7 +803,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ReciprocalAreaUnit unitAsReciprocalAreaUnit)) + if (!(unit is ReciprocalAreaUnit unitAsReciprocalAreaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReciprocalAreaUnit)} is supported.", nameof(unit)); return As(unitAsReciprocalAreaUnit); @@ -828,18 +827,18 @@ public ReciprocalArea ToUnit(ReciprocalAreaUnit unit) /// A ReciprocalArea with the specified unit. public ReciprocalArea ToUnit(ReciprocalAreaUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ReciprocalArea), Unit, typeof(ReciprocalArea), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ReciprocalArea), Unit, typeof(ReciprocalArea), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ReciprocalArea)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -854,7 +853,7 @@ public ReciprocalArea ToUnit(ReciprocalAreaUnit unit, UnitConverter unitConverte /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ReciprocalAreaUnit unitAsReciprocalAreaUnit)) + if (!(unit is ReciprocalAreaUnit unitAsReciprocalAreaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReciprocalAreaUnit)} is supported.", nameof(unit)); return ToUnit(unitAsReciprocalAreaUnit, DefaultConversionFunctions); @@ -863,7 +862,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ReciprocalAreaUnit unitAsReciprocalAreaUnit)) + if (!(unit is ReciprocalAreaUnit unitAsReciprocalAreaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReciprocalAreaUnit)} is supported.", nameof(unit)); return ToUnit(unitAsReciprocalAreaUnit, unitConverter); @@ -872,13 +871,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ReciprocalArea ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1053,15 +1052,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ReciprocalArea)) + if (conversionType == typeof(ReciprocalArea)) return this; - else if(conversionType == typeof(ReciprocalAreaUnit)) + else if (conversionType == typeof(ReciprocalAreaUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ReciprocalArea.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ReciprocalArea.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ReciprocalArea.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ReciprocalArea)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs index 6fb31ee6de..f7fa155ee2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs @@ -91,7 +91,7 @@ static ReciprocalLength() /// If value is NaN or Infinity. public ReciprocalLength(double value, ReciprocalLengthUnit unit) { - if(unit == ReciprocalLengthUnit.Undefined) + if (unit == ReciprocalLengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -108,7 +108,7 @@ public ReciprocalLength(double value, ReciprocalLengthUnit unit) /// No unit was found for the given . public ReciprocalLength(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -270,7 +270,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ReciprocalLengthUnit.InverseMeter, ReciprocalLengthUnit.InverseMillimeter, quantity => new ReciprocalLength(quantity.Value/1e3, ReciprocalLengthUnit.InverseMillimeter)); unitConverter.SetConversionFunction(ReciprocalLengthUnit.InverseMeter, ReciprocalLengthUnit.InverseUsSurveyFoot, quantity => new ReciprocalLength(quantity.Value*1200/3937, ReciprocalLengthUnit.InverseUsSurveyFoot)); unitConverter.SetConversionFunction(ReciprocalLengthUnit.InverseMeter, ReciprocalLengthUnit.InverseYard, quantity => new ReciprocalLength(quantity.Value*0.9144, ReciprocalLengthUnit.InverseYard)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ReciprocalLengthUnit.InverseMeter, ReciprocalLengthUnit.InverseMeter, quantity => quantity); @@ -662,8 +661,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Recip /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ReciprocalLength objReciprocalLength)) throw new ArgumentException("Expected type ReciprocalLength.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ReciprocalLength objReciprocalLength)) throw new ArgumentException("Expected type ReciprocalLength.", nameof(obj)); return CompareTo(objReciprocalLength); } @@ -678,7 +677,7 @@ public int CompareTo(ReciprocalLength other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ReciprocalLength objReciprocalLength)) + if (obj is null || !(obj is ReciprocalLength objReciprocalLength)) return false; return Equals(objReciprocalLength); @@ -733,7 +732,7 @@ public bool Equals(ReciprocalLength other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ReciprocalLength other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -761,7 +760,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ReciprocalLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -771,13 +770,13 @@ public double As(ReciprocalLengthUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -786,7 +785,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ReciprocalLengthUnit unitAsReciprocalLengthUnit)) + if (!(unit is ReciprocalLengthUnit unitAsReciprocalLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReciprocalLengthUnit)} is supported.", nameof(unit)); return As(unitAsReciprocalLengthUnit); @@ -810,18 +809,18 @@ public ReciprocalLength ToUnit(ReciprocalLengthUnit unit) /// A ReciprocalLength with the specified unit. public ReciprocalLength ToUnit(ReciprocalLengthUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ReciprocalLength), Unit, typeof(ReciprocalLength), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ReciprocalLength), Unit, typeof(ReciprocalLength), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ReciprocalLength)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -836,7 +835,7 @@ public ReciprocalLength ToUnit(ReciprocalLengthUnit unit, UnitConverter unitConv /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ReciprocalLengthUnit unitAsReciprocalLengthUnit)) + if (!(unit is ReciprocalLengthUnit unitAsReciprocalLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReciprocalLengthUnit)} is supported.", nameof(unit)); return ToUnit(unitAsReciprocalLengthUnit, DefaultConversionFunctions); @@ -845,7 +844,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ReciprocalLengthUnit unitAsReciprocalLengthUnit)) + if (!(unit is ReciprocalLengthUnit unitAsReciprocalLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReciprocalLengthUnit)} is supported.", nameof(unit)); return ToUnit(unitAsReciprocalLengthUnit, unitConverter); @@ -854,13 +853,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ReciprocalLength ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1035,15 +1034,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ReciprocalLength)) + if (conversionType == typeof(ReciprocalLength)) return this; - else if(conversionType == typeof(ReciprocalLengthUnit)) + else if (conversionType == typeof(ReciprocalLengthUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ReciprocalLength.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ReciprocalLength.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ReciprocalLength.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ReciprocalLength)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs index 431062975c..7ef842d9af 100644 --- a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs @@ -79,7 +79,7 @@ static RelativeHumidity() /// If value is NaN or Infinity. public RelativeHumidity(double value, RelativeHumidityUnit unit) { - if(unit == RelativeHumidityUnit.Undefined) + if (unit == RelativeHumidityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -96,7 +96,7 @@ public RelativeHumidity(double value, RelativeHumidityUnit unit) /// No unit was found for the given . public RelativeHumidity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -204,7 +204,6 @@ public RelativeHumidity(double value, UnitSystem unitSystem) internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> RelativeHumidityUnit - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(RelativeHumidityUnit.Percent, RelativeHumidityUnit.Percent, quantity => quantity); @@ -497,8 +496,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Relat /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RelativeHumidity objRelativeHumidity)) throw new ArgumentException("Expected type RelativeHumidity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is RelativeHumidity objRelativeHumidity)) throw new ArgumentException("Expected type RelativeHumidity.", nameof(obj)); return CompareTo(objRelativeHumidity); } @@ -513,7 +512,7 @@ public int CompareTo(RelativeHumidity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is RelativeHumidity objRelativeHumidity)) + if (obj is null || !(obj is RelativeHumidity objRelativeHumidity)) return false; return Equals(objRelativeHumidity); @@ -568,7 +567,7 @@ public bool Equals(RelativeHumidity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(RelativeHumidity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -596,7 +595,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(RelativeHumidityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -606,13 +605,13 @@ public double As(RelativeHumidityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -621,7 +620,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is RelativeHumidityUnit unitAsRelativeHumidityUnit)) + if (!(unit is RelativeHumidityUnit unitAsRelativeHumidityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RelativeHumidityUnit)} is supported.", nameof(unit)); return As(unitAsRelativeHumidityUnit); @@ -645,18 +644,18 @@ public RelativeHumidity ToUnit(RelativeHumidityUnit unit) /// A RelativeHumidity with the specified unit. public RelativeHumidity ToUnit(RelativeHumidityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(RelativeHumidity), Unit, typeof(RelativeHumidity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(RelativeHumidity), Unit, typeof(RelativeHumidity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (RelativeHumidity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -671,7 +670,7 @@ public RelativeHumidity ToUnit(RelativeHumidityUnit unit, UnitConverter unitConv /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is RelativeHumidityUnit unitAsRelativeHumidityUnit)) + if (!(unit is RelativeHumidityUnit unitAsRelativeHumidityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RelativeHumidityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsRelativeHumidityUnit, DefaultConversionFunctions); @@ -680,7 +679,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is RelativeHumidityUnit unitAsRelativeHumidityUnit)) + if (!(unit is RelativeHumidityUnit unitAsRelativeHumidityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RelativeHumidityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsRelativeHumidityUnit, unitConverter); @@ -689,13 +688,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public RelativeHumidity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -870,15 +869,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(RelativeHumidity)) + if (conversionType == typeof(RelativeHumidity)) return this; - else if(conversionType == typeof(RelativeHumidityUnit)) + else if (conversionType == typeof(RelativeHumidityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return RelativeHumidity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return RelativeHumidity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return RelativeHumidity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(RelativeHumidity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs index abeab6687a..96a811f233 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs @@ -82,7 +82,7 @@ static RotationalAcceleration() /// If value is NaN or Infinity. public RotationalAcceleration(double value, RotationalAccelerationUnit unit) { - if(unit == RotationalAccelerationUnit.Undefined) + if (unit == RotationalAccelerationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public RotationalAcceleration(double value, RotationalAccelerationUnit unit) /// No unit was found for the given . public RotationalAcceleration(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -225,7 +225,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(RotationalAccelerationUnit.RadianPerSecondSquared, RotationalAccelerationUnit.DegreePerSecondSquared, quantity => new RotationalAcceleration((180/Math.PI)*quantity.Value, RotationalAccelerationUnit.DegreePerSecondSquared)); unitConverter.SetConversionFunction(RotationalAccelerationUnit.RadianPerSecondSquared, RotationalAccelerationUnit.RevolutionPerMinutePerSecond, quantity => new RotationalAcceleration((60/(2*Math.PI))*quantity.Value, RotationalAccelerationUnit.RevolutionPerMinutePerSecond)); unitConverter.SetConversionFunction(RotationalAccelerationUnit.RadianPerSecondSquared, RotationalAccelerationUnit.RevolutionPerSecondSquared, quantity => new RotationalAcceleration((1/(2*Math.PI))*quantity.Value, RotationalAccelerationUnit.RevolutionPerSecondSquared)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(RotationalAccelerationUnit.RadianPerSecondSquared, RotationalAccelerationUnit.RadianPerSecondSquared, quantity => quantity); @@ -551,8 +550,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Rotat /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalAcceleration objRotationalAcceleration)) throw new ArgumentException("Expected type RotationalAcceleration.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is RotationalAcceleration objRotationalAcceleration)) throw new ArgumentException("Expected type RotationalAcceleration.", nameof(obj)); return CompareTo(objRotationalAcceleration); } @@ -567,7 +566,7 @@ public int CompareTo(RotationalAcceleration other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is RotationalAcceleration objRotationalAcceleration)) + if (obj is null || !(obj is RotationalAcceleration objRotationalAcceleration)) return false; return Equals(objRotationalAcceleration); @@ -622,7 +621,7 @@ public bool Equals(RotationalAcceleration other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(RotationalAcceleration other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -650,7 +649,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(RotationalAccelerationUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -660,13 +659,13 @@ public double As(RotationalAccelerationUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -675,7 +674,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is RotationalAccelerationUnit unitAsRotationalAccelerationUnit)) + if (!(unit is RotationalAccelerationUnit unitAsRotationalAccelerationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalAccelerationUnit)} is supported.", nameof(unit)); return As(unitAsRotationalAccelerationUnit); @@ -699,18 +698,18 @@ public RotationalAcceleration ToUnit(RotationalAccelerationUnit unit) /// A RotationalAcceleration with the specified unit. public RotationalAcceleration ToUnit(RotationalAccelerationUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(RotationalAcceleration), Unit, typeof(RotationalAcceleration), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(RotationalAcceleration), Unit, typeof(RotationalAcceleration), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (RotationalAcceleration)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -725,7 +724,7 @@ public RotationalAcceleration ToUnit(RotationalAccelerationUnit unit, UnitConver /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is RotationalAccelerationUnit unitAsRotationalAccelerationUnit)) + if (!(unit is RotationalAccelerationUnit unitAsRotationalAccelerationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalAccelerationUnit)} is supported.", nameof(unit)); return ToUnit(unitAsRotationalAccelerationUnit, DefaultConversionFunctions); @@ -734,7 +733,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is RotationalAccelerationUnit unitAsRotationalAccelerationUnit)) + if (!(unit is RotationalAccelerationUnit unitAsRotationalAccelerationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalAccelerationUnit)} is supported.", nameof(unit)); return ToUnit(unitAsRotationalAccelerationUnit, unitConverter); @@ -743,13 +742,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public RotationalAcceleration ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -924,15 +923,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(RotationalAcceleration)) + if (conversionType == typeof(RotationalAcceleration)) return this; - else if(conversionType == typeof(RotationalAccelerationUnit)) + else if (conversionType == typeof(RotationalAccelerationUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return RotationalAcceleration.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return RotationalAcceleration.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return RotationalAcceleration.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs index f8779591a2..7a4c5d9e46 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -91,7 +91,7 @@ static RotationalSpeed() /// If value is NaN or Infinity. public RotationalSpeed(double value, RotationalSpeedUnit unit) { - if(unit == RotationalSpeedUnit.Undefined) + if (unit == RotationalSpeedUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -108,7 +108,7 @@ public RotationalSpeed(double value, RotationalSpeedUnit unit) /// No unit was found for the given . public RotationalSpeed(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -288,7 +288,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(RotationalSpeedUnit.RadianPerSecond, RotationalSpeedUnit.NanoradianPerSecond, quantity => new RotationalSpeed((quantity.Value) / 1e-9d, RotationalSpeedUnit.NanoradianPerSecond)); unitConverter.SetConversionFunction(RotationalSpeedUnit.RadianPerSecond, RotationalSpeedUnit.RevolutionPerMinute, quantity => new RotationalSpeed((quantity.Value/6.2831853072)*60, RotationalSpeedUnit.RevolutionPerMinute)); unitConverter.SetConversionFunction(RotationalSpeedUnit.RadianPerSecond, RotationalSpeedUnit.RevolutionPerSecond, quantity => new RotationalSpeed(quantity.Value/6.2831853072, RotationalSpeedUnit.RevolutionPerSecond)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(RotationalSpeedUnit.RadianPerSecond, RotationalSpeedUnit.RadianPerSecond, quantity => quantity); @@ -725,8 +724,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Rotat /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalSpeed objRotationalSpeed)) throw new ArgumentException("Expected type RotationalSpeed.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is RotationalSpeed objRotationalSpeed)) throw new ArgumentException("Expected type RotationalSpeed.", nameof(obj)); return CompareTo(objRotationalSpeed); } @@ -741,7 +740,7 @@ public int CompareTo(RotationalSpeed other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is RotationalSpeed objRotationalSpeed)) + if (obj is null || !(obj is RotationalSpeed objRotationalSpeed)) return false; return Equals(objRotationalSpeed); @@ -796,7 +795,7 @@ public bool Equals(RotationalSpeed other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(RotationalSpeed other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -824,7 +823,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(RotationalSpeedUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -834,13 +833,13 @@ public double As(RotationalSpeedUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -849,7 +848,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is RotationalSpeedUnit unitAsRotationalSpeedUnit)) + if (!(unit is RotationalSpeedUnit unitAsRotationalSpeedUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalSpeedUnit)} is supported.", nameof(unit)); return As(unitAsRotationalSpeedUnit); @@ -873,18 +872,18 @@ public RotationalSpeed ToUnit(RotationalSpeedUnit unit) /// A RotationalSpeed with the specified unit. public RotationalSpeed ToUnit(RotationalSpeedUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(RotationalSpeed), Unit, typeof(RotationalSpeed), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(RotationalSpeed), Unit, typeof(RotationalSpeed), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (RotationalSpeed)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -899,7 +898,7 @@ public RotationalSpeed ToUnit(RotationalSpeedUnit unit, UnitConverter unitConver /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is RotationalSpeedUnit unitAsRotationalSpeedUnit)) + if (!(unit is RotationalSpeedUnit unitAsRotationalSpeedUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalSpeedUnit)} is supported.", nameof(unit)); return ToUnit(unitAsRotationalSpeedUnit, DefaultConversionFunctions); @@ -908,7 +907,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is RotationalSpeedUnit unitAsRotationalSpeedUnit)) + if (!(unit is RotationalSpeedUnit unitAsRotationalSpeedUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalSpeedUnit)} is supported.", nameof(unit)); return ToUnit(unitAsRotationalSpeedUnit, unitConverter); @@ -917,13 +916,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public RotationalSpeed ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1098,15 +1097,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(RotationalSpeed)) + if (conversionType == typeof(RotationalSpeed)) return this; - else if(conversionType == typeof(RotationalSpeedUnit)) + else if (conversionType == typeof(RotationalSpeedUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return RotationalSpeed.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return RotationalSpeed.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return RotationalSpeed.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs index ff9fec4b43..7592e2d771 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -111,7 +111,7 @@ static RotationalStiffness() /// If value is NaN or Infinity. public RotationalStiffness(double value, RotationalStiffnessUnit unit) { - if(unit == RotationalStiffnessUnit.Undefined) + if (unit == RotationalStiffnessUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -128,7 +128,7 @@ public RotationalStiffness(double value, RotationalStiffnessUnit unit) /// No unit was found for the given . public RotationalStiffness(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -428,7 +428,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(RotationalStiffnessUnit.NewtonMeterPerRadian, RotationalStiffnessUnit.NewtonMillimeterPerRadian, quantity => new RotationalStiffness(quantity.Value*1000, RotationalStiffnessUnit.NewtonMillimeterPerRadian)); unitConverter.SetConversionFunction(RotationalStiffnessUnit.NewtonMeterPerRadian, RotationalStiffnessUnit.PoundForceFeetPerRadian, quantity => new RotationalStiffness(quantity.Value/1.3558179483314, RotationalStiffnessUnit.PoundForceFeetPerRadian)); unitConverter.SetConversionFunction(RotationalStiffnessUnit.NewtonMeterPerRadian, RotationalStiffnessUnit.PoundForceFootPerDegrees, quantity => new RotationalStiffness(quantity.Value/77.6826, RotationalStiffnessUnit.PoundForceFootPerDegrees)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(RotationalStiffnessUnit.NewtonMeterPerRadian, RotationalStiffnessUnit.NewtonMeterPerRadian, quantity => quantity); @@ -1073,8 +1072,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Rotat /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalStiffness objRotationalStiffness)) throw new ArgumentException("Expected type RotationalStiffness.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is RotationalStiffness objRotationalStiffness)) throw new ArgumentException("Expected type RotationalStiffness.", nameof(obj)); return CompareTo(objRotationalStiffness); } @@ -1089,7 +1088,7 @@ public int CompareTo(RotationalStiffness other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is RotationalStiffness objRotationalStiffness)) + if (obj is null || !(obj is RotationalStiffness objRotationalStiffness)) return false; return Equals(objRotationalStiffness); @@ -1144,7 +1143,7 @@ public bool Equals(RotationalStiffness other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(RotationalStiffness other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1172,7 +1171,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(RotationalStiffnessUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1182,13 +1181,13 @@ public double As(RotationalStiffnessUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1197,7 +1196,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is RotationalStiffnessUnit unitAsRotationalStiffnessUnit)) + if (!(unit is RotationalStiffnessUnit unitAsRotationalStiffnessUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalStiffnessUnit)} is supported.", nameof(unit)); return As(unitAsRotationalStiffnessUnit); @@ -1221,18 +1220,18 @@ public RotationalStiffness ToUnit(RotationalStiffnessUnit unit) /// A RotationalStiffness with the specified unit. public RotationalStiffness ToUnit(RotationalStiffnessUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(RotationalStiffness), Unit, typeof(RotationalStiffness), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(RotationalStiffness), Unit, typeof(RotationalStiffness), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (RotationalStiffness)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1247,7 +1246,7 @@ public RotationalStiffness ToUnit(RotationalStiffnessUnit unit, UnitConverter un /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is RotationalStiffnessUnit unitAsRotationalStiffnessUnit)) + if (!(unit is RotationalStiffnessUnit unitAsRotationalStiffnessUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalStiffnessUnit)} is supported.", nameof(unit)); return ToUnit(unitAsRotationalStiffnessUnit, DefaultConversionFunctions); @@ -1256,7 +1255,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is RotationalStiffnessUnit unitAsRotationalStiffnessUnit)) + if (!(unit is RotationalStiffnessUnit unitAsRotationalStiffnessUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalStiffnessUnit)} is supported.", nameof(unit)); return ToUnit(unitAsRotationalStiffnessUnit, unitConverter); @@ -1265,13 +1264,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public RotationalStiffness ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1446,15 +1445,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(RotationalStiffness)) + if (conversionType == typeof(RotationalStiffness)) return this; - else if(conversionType == typeof(RotationalStiffnessUnit)) + else if (conversionType == typeof(RotationalStiffnessUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return RotationalStiffness.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return RotationalStiffness.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return RotationalStiffness.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs index 9383f164e2..814ae7e4d2 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -83,7 +83,7 @@ static RotationalStiffnessPerLength() /// If value is NaN or Infinity. public RotationalStiffnessPerLength(double value, RotationalStiffnessPerLengthUnit unit) { - if(unit == RotationalStiffnessPerLengthUnit.Undefined) + if (unit == RotationalStiffnessPerLengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -100,7 +100,7 @@ public RotationalStiffnessPerLength(double value, RotationalStiffnessPerLengthUn /// No unit was found for the given . public RotationalStiffnessPerLength(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -232,7 +232,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter, RotationalStiffnessPerLengthUnit.KilopoundForceFootPerDegreesPerFoot, quantity => new RotationalStiffnessPerLength(quantity.Value/254864.324570, RotationalStiffnessPerLengthUnit.KilopoundForceFootPerDegreesPerFoot)); unitConverter.SetConversionFunction(RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter, RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter, quantity => new RotationalStiffnessPerLength((quantity.Value) / 1e6d, RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter)); unitConverter.SetConversionFunction(RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter, RotationalStiffnessPerLengthUnit.PoundForceFootPerDegreesPerFoot, quantity => new RotationalStiffnessPerLength(quantity.Value/254.864324570, RotationalStiffnessPerLengthUnit.PoundForceFootPerDegreesPerFoot)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter, quantity => quantity); @@ -569,8 +568,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Rotat /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalStiffnessPerLength objRotationalStiffnessPerLength)) throw new ArgumentException("Expected type RotationalStiffnessPerLength.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is RotationalStiffnessPerLength objRotationalStiffnessPerLength)) throw new ArgumentException("Expected type RotationalStiffnessPerLength.", nameof(obj)); return CompareTo(objRotationalStiffnessPerLength); } @@ -585,7 +584,7 @@ public int CompareTo(RotationalStiffnessPerLength other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is RotationalStiffnessPerLength objRotationalStiffnessPerLength)) + if (obj is null || !(obj is RotationalStiffnessPerLength objRotationalStiffnessPerLength)) return false; return Equals(objRotationalStiffnessPerLength); @@ -640,7 +639,7 @@ public bool Equals(RotationalStiffnessPerLength other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(RotationalStiffnessPerLength other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -668,7 +667,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(RotationalStiffnessPerLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -678,13 +677,13 @@ public double As(RotationalStiffnessPerLengthUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -693,7 +692,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is RotationalStiffnessPerLengthUnit unitAsRotationalStiffnessPerLengthUnit)) + if (!(unit is RotationalStiffnessPerLengthUnit unitAsRotationalStiffnessPerLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalStiffnessPerLengthUnit)} is supported.", nameof(unit)); return As(unitAsRotationalStiffnessPerLengthUnit); @@ -717,18 +716,18 @@ public RotationalStiffnessPerLength ToUnit(RotationalStiffnessPerLengthUnit unit /// A RotationalStiffnessPerLength with the specified unit. public RotationalStiffnessPerLength ToUnit(RotationalStiffnessPerLengthUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(RotationalStiffnessPerLength), Unit, typeof(RotationalStiffnessPerLength), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(RotationalStiffnessPerLength), Unit, typeof(RotationalStiffnessPerLength), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (RotationalStiffnessPerLength)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -743,7 +742,7 @@ public RotationalStiffnessPerLength ToUnit(RotationalStiffnessPerLengthUnit unit /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is RotationalStiffnessPerLengthUnit unitAsRotationalStiffnessPerLengthUnit)) + if (!(unit is RotationalStiffnessPerLengthUnit unitAsRotationalStiffnessPerLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalStiffnessPerLengthUnit)} is supported.", nameof(unit)); return ToUnit(unitAsRotationalStiffnessPerLengthUnit, DefaultConversionFunctions); @@ -752,7 +751,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is RotationalStiffnessPerLengthUnit unitAsRotationalStiffnessPerLengthUnit)) + if (!(unit is RotationalStiffnessPerLengthUnit unitAsRotationalStiffnessPerLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalStiffnessPerLengthUnit)} is supported.", nameof(unit)); return ToUnit(unitAsRotationalStiffnessPerLengthUnit, unitConverter); @@ -761,13 +760,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public RotationalStiffnessPerLength ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -942,15 +941,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(RotationalStiffnessPerLength)) + if (conversionType == typeof(RotationalStiffnessPerLength)) return this; - else if(conversionType == typeof(RotationalStiffnessPerLengthUnit)) + else if (conversionType == typeof(RotationalStiffnessPerLengthUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return RotationalStiffnessPerLength.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return RotationalStiffnessPerLength.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return RotationalStiffnessPerLength.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs index dcbe922a8a..cdc2f0080a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs @@ -79,7 +79,7 @@ static Scalar() /// If value is NaN or Infinity. public Scalar(double value, ScalarUnit unit) { - if(unit == ScalarUnit.Undefined) + if (unit == ScalarUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -96,7 +96,7 @@ public Scalar(double value, ScalarUnit unit) /// No unit was found for the given . public Scalar(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -204,7 +204,6 @@ public Scalar(double value, UnitSystem unitSystem) internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> ScalarUnit - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ScalarUnit.Amount, ScalarUnit.Amount, quantity => quantity); @@ -497,8 +496,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Scala /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Scalar objScalar)) throw new ArgumentException("Expected type Scalar.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Scalar objScalar)) throw new ArgumentException("Expected type Scalar.", nameof(obj)); return CompareTo(objScalar); } @@ -513,7 +512,7 @@ public int CompareTo(Scalar other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Scalar objScalar)) + if (obj is null || !(obj is Scalar objScalar)) return false; return Equals(objScalar); @@ -568,7 +567,7 @@ public bool Equals(Scalar other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Scalar other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -596,7 +595,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ScalarUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -606,13 +605,13 @@ public double As(ScalarUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -621,7 +620,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ScalarUnit unitAsScalarUnit)) + if (!(unit is ScalarUnit unitAsScalarUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ScalarUnit)} is supported.", nameof(unit)); return As(unitAsScalarUnit); @@ -645,18 +644,18 @@ public Scalar ToUnit(ScalarUnit unit) /// A Scalar with the specified unit. public Scalar ToUnit(ScalarUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Scalar), Unit, typeof(Scalar), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Scalar), Unit, typeof(Scalar), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Scalar)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -671,7 +670,7 @@ public Scalar ToUnit(ScalarUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ScalarUnit unitAsScalarUnit)) + if (!(unit is ScalarUnit unitAsScalarUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ScalarUnit)} is supported.", nameof(unit)); return ToUnit(unitAsScalarUnit, DefaultConversionFunctions); @@ -680,7 +679,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ScalarUnit unitAsScalarUnit)) + if (!(unit is ScalarUnit unitAsScalarUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ScalarUnit)} is supported.", nameof(unit)); return ToUnit(unitAsScalarUnit, unitConverter); @@ -689,13 +688,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Scalar ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -870,15 +869,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Scalar)) + if (conversionType == typeof(Scalar)) return this; - else if(conversionType == typeof(ScalarUnit)) + else if (conversionType == typeof(ScalarUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Scalar.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Scalar.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Scalar.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Scalar)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs index 463f147220..975601b5d4 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs @@ -82,7 +82,7 @@ static SolidAngle() /// If value is NaN or Infinity. public SolidAngle(double value, SolidAngleUnit unit) { - if(unit == SolidAngleUnit.Undefined) + if (unit == SolidAngleUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public SolidAngle(double value, SolidAngleUnit unit) /// No unit was found for the given . public SolidAngle(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -207,7 +207,6 @@ public SolidAngle(double value, UnitSystem unitSystem) internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> SolidAngleUnit - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(SolidAngleUnit.Steradian, SolidAngleUnit.Steradian, quantity => quantity); @@ -500,8 +499,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Solid /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SolidAngle objSolidAngle)) throw new ArgumentException("Expected type SolidAngle.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is SolidAngle objSolidAngle)) throw new ArgumentException("Expected type SolidAngle.", nameof(obj)); return CompareTo(objSolidAngle); } @@ -516,7 +515,7 @@ public int CompareTo(SolidAngle other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is SolidAngle objSolidAngle)) + if (obj is null || !(obj is SolidAngle objSolidAngle)) return false; return Equals(objSolidAngle); @@ -571,7 +570,7 @@ public bool Equals(SolidAngle other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(SolidAngle other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -599,7 +598,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(SolidAngleUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -609,13 +608,13 @@ public double As(SolidAngleUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -624,7 +623,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is SolidAngleUnit unitAsSolidAngleUnit)) + if (!(unit is SolidAngleUnit unitAsSolidAngleUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SolidAngleUnit)} is supported.", nameof(unit)); return As(unitAsSolidAngleUnit); @@ -648,18 +647,18 @@ public SolidAngle ToUnit(SolidAngleUnit unit) /// A SolidAngle with the specified unit. public SolidAngle ToUnit(SolidAngleUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(SolidAngle), Unit, typeof(SolidAngle), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(SolidAngle), Unit, typeof(SolidAngle), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (SolidAngle)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -674,7 +673,7 @@ public SolidAngle ToUnit(SolidAngleUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is SolidAngleUnit unitAsSolidAngleUnit)) + if (!(unit is SolidAngleUnit unitAsSolidAngleUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SolidAngleUnit)} is supported.", nameof(unit)); return ToUnit(unitAsSolidAngleUnit, DefaultConversionFunctions); @@ -683,7 +682,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is SolidAngleUnit unitAsSolidAngleUnit)) + if (!(unit is SolidAngleUnit unitAsSolidAngleUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SolidAngleUnit)} is supported.", nameof(unit)); return ToUnit(unitAsSolidAngleUnit, unitConverter); @@ -692,13 +691,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public SolidAngle ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -873,15 +872,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(SolidAngle)) + if (conversionType == typeof(SolidAngle)) return this; - else if(conversionType == typeof(SolidAngleUnit)) + else if (conversionType == typeof(SolidAngleUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return SolidAngle.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return SolidAngle.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return SolidAngle.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(SolidAngle)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs index b504199dd8..4edeab1ddd 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -106,7 +106,7 @@ static SpecificEnergy() /// If value is NaN or Infinity. public SpecificEnergy(double value, SpecificEnergyUnit unit) { - if(unit == SpecificEnergyUnit.Undefined) + if (unit == SpecificEnergyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -123,7 +123,7 @@ public SpecificEnergy(double value, SpecificEnergyUnit unit) /// No unit was found for the given . public SpecificEnergy(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -375,7 +375,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(SpecificEnergyUnit.JoulePerKilogram, SpecificEnergyUnit.WattDayPerShortTon, quantity => new SpecificEnergy(quantity.Value/((24*3.6e3)/9.0718474e2), SpecificEnergyUnit.WattDayPerShortTon)); unitConverter.SetConversionFunction(SpecificEnergyUnit.JoulePerKilogram, SpecificEnergyUnit.WattDayPerTonne, quantity => new SpecificEnergy(quantity.Value/((24*3.6e3)/1e3), SpecificEnergyUnit.WattDayPerTonne)); unitConverter.SetConversionFunction(SpecificEnergyUnit.JoulePerKilogram, SpecificEnergyUnit.WattHourPerKilogram, quantity => new SpecificEnergy(quantity.Value/3.6e3, SpecificEnergyUnit.WattHourPerKilogram)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(SpecificEnergyUnit.JoulePerKilogram, SpecificEnergyUnit.JoulePerKilogram, quantity => quantity); @@ -932,8 +931,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Speci /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificEnergy objSpecificEnergy)) throw new ArgumentException("Expected type SpecificEnergy.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is SpecificEnergy objSpecificEnergy)) throw new ArgumentException("Expected type SpecificEnergy.", nameof(obj)); return CompareTo(objSpecificEnergy); } @@ -948,7 +947,7 @@ public int CompareTo(SpecificEnergy other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is SpecificEnergy objSpecificEnergy)) + if (obj is null || !(obj is SpecificEnergy objSpecificEnergy)) return false; return Equals(objSpecificEnergy); @@ -1003,7 +1002,7 @@ public bool Equals(SpecificEnergy other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(SpecificEnergy other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1031,7 +1030,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(SpecificEnergyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1041,13 +1040,13 @@ public double As(SpecificEnergyUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1056,7 +1055,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is SpecificEnergyUnit unitAsSpecificEnergyUnit)) + if (!(unit is SpecificEnergyUnit unitAsSpecificEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificEnergyUnit)} is supported.", nameof(unit)); return As(unitAsSpecificEnergyUnit); @@ -1080,18 +1079,18 @@ public SpecificEnergy ToUnit(SpecificEnergyUnit unit) /// A SpecificEnergy with the specified unit. public SpecificEnergy ToUnit(SpecificEnergyUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(SpecificEnergy), Unit, typeof(SpecificEnergy), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(SpecificEnergy), Unit, typeof(SpecificEnergy), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (SpecificEnergy)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1106,7 +1105,7 @@ public SpecificEnergy ToUnit(SpecificEnergyUnit unit, UnitConverter unitConverte /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is SpecificEnergyUnit unitAsSpecificEnergyUnit)) + if (!(unit is SpecificEnergyUnit unitAsSpecificEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificEnergyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsSpecificEnergyUnit, DefaultConversionFunctions); @@ -1115,7 +1114,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is SpecificEnergyUnit unitAsSpecificEnergyUnit)) + if (!(unit is SpecificEnergyUnit unitAsSpecificEnergyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificEnergyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsSpecificEnergyUnit, unitConverter); @@ -1124,13 +1123,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public SpecificEnergy ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1305,15 +1304,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(SpecificEnergy)) + if (conversionType == typeof(SpecificEnergy)) return this; - else if(conversionType == typeof(SpecificEnergyUnit)) + else if (conversionType == typeof(SpecificEnergyUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return SpecificEnergy.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return SpecificEnergy.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return SpecificEnergy.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs index aa9732e694..de2dd215b2 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -87,7 +87,7 @@ static SpecificEntropy() /// If value is NaN or Infinity. public SpecificEntropy(double value, SpecificEntropyUnit unit) { - if(unit == SpecificEntropyUnit.Undefined) + if (unit == SpecificEntropyUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -104,7 +104,7 @@ public SpecificEntropy(double value, SpecificEntropyUnit unit) /// No unit was found for the given . public SpecificEntropy(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -260,7 +260,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(SpecificEntropyUnit.JoulePerKilogramKelvin, SpecificEntropyUnit.KilojoulePerKilogramKelvin, quantity => new SpecificEntropy((quantity.Value) / 1e3d, SpecificEntropyUnit.KilojoulePerKilogramKelvin)); unitConverter.SetConversionFunction(SpecificEntropyUnit.JoulePerKilogramKelvin, SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius, quantity => new SpecificEntropy((quantity.Value) / 1e6d, SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius)); unitConverter.SetConversionFunction(SpecificEntropyUnit.JoulePerKilogramKelvin, SpecificEntropyUnit.MegajoulePerKilogramKelvin, quantity => new SpecificEntropy((quantity.Value) / 1e6d, SpecificEntropyUnit.MegajoulePerKilogramKelvin)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(SpecificEntropyUnit.JoulePerKilogramKelvin, SpecificEntropyUnit.JoulePerKilogramKelvin, quantity => quantity); @@ -641,8 +640,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Speci /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificEntropy objSpecificEntropy)) throw new ArgumentException("Expected type SpecificEntropy.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is SpecificEntropy objSpecificEntropy)) throw new ArgumentException("Expected type SpecificEntropy.", nameof(obj)); return CompareTo(objSpecificEntropy); } @@ -657,7 +656,7 @@ public int CompareTo(SpecificEntropy other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is SpecificEntropy objSpecificEntropy)) + if (obj is null || !(obj is SpecificEntropy objSpecificEntropy)) return false; return Equals(objSpecificEntropy); @@ -712,7 +711,7 @@ public bool Equals(SpecificEntropy other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(SpecificEntropy other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -740,7 +739,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(SpecificEntropyUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -750,13 +749,13 @@ public double As(SpecificEntropyUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -765,7 +764,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is SpecificEntropyUnit unitAsSpecificEntropyUnit)) + if (!(unit is SpecificEntropyUnit unitAsSpecificEntropyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificEntropyUnit)} is supported.", nameof(unit)); return As(unitAsSpecificEntropyUnit); @@ -789,18 +788,18 @@ public SpecificEntropy ToUnit(SpecificEntropyUnit unit) /// A SpecificEntropy with the specified unit. public SpecificEntropy ToUnit(SpecificEntropyUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(SpecificEntropy), Unit, typeof(SpecificEntropy), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(SpecificEntropy), Unit, typeof(SpecificEntropy), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (SpecificEntropy)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -815,7 +814,7 @@ public SpecificEntropy ToUnit(SpecificEntropyUnit unit, UnitConverter unitConver /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is SpecificEntropyUnit unitAsSpecificEntropyUnit)) + if (!(unit is SpecificEntropyUnit unitAsSpecificEntropyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificEntropyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsSpecificEntropyUnit, DefaultConversionFunctions); @@ -824,7 +823,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is SpecificEntropyUnit unitAsSpecificEntropyUnit)) + if (!(unit is SpecificEntropyUnit unitAsSpecificEntropyUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificEntropyUnit)} is supported.", nameof(unit)); return ToUnit(unitAsSpecificEntropyUnit, unitConverter); @@ -833,13 +832,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public SpecificEntropy ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1014,15 +1013,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(SpecificEntropy)) + if (conversionType == typeof(SpecificEntropy)) return this; - else if(conversionType == typeof(SpecificEntropyUnit)) + else if (conversionType == typeof(SpecificEntropyUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return SpecificEntropy.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return SpecificEntropy.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return SpecificEntropy.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs index d77132f455..801bcd760f 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs @@ -85,7 +85,7 @@ static SpecificFuelConsumption() /// If value is NaN or Infinity. public SpecificFuelConsumption(double value, SpecificFuelConsumptionUnit unit) { - if(unit == SpecificFuelConsumptionUnit.Undefined) + if (unit == SpecificFuelConsumptionUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -102,7 +102,7 @@ public SpecificFuelConsumption(double value, SpecificFuelConsumptionUnit unit) /// No unit was found for the given . public SpecificFuelConsumption(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -228,7 +228,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(SpecificFuelConsumptionUnit.GramPerKiloNewtonSecond, SpecificFuelConsumptionUnit.KilogramPerKilogramForceHour, quantity => new SpecificFuelConsumption(quantity.Value/28.33, SpecificFuelConsumptionUnit.KilogramPerKilogramForceHour)); unitConverter.SetConversionFunction(SpecificFuelConsumptionUnit.GramPerKiloNewtonSecond, SpecificFuelConsumptionUnit.KilogramPerKiloNewtonSecond, quantity => new SpecificFuelConsumption((quantity.Value) / 1e3d, SpecificFuelConsumptionUnit.KilogramPerKiloNewtonSecond)); unitConverter.SetConversionFunction(SpecificFuelConsumptionUnit.GramPerKiloNewtonSecond, SpecificFuelConsumptionUnit.PoundMassPerPoundForceHour, quantity => new SpecificFuelConsumption(quantity.Value/28.33, SpecificFuelConsumptionUnit.PoundMassPerPoundForceHour)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(SpecificFuelConsumptionUnit.GramPerKiloNewtonSecond, SpecificFuelConsumptionUnit.GramPerKiloNewtonSecond, quantity => quantity); @@ -554,8 +553,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Speci /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificFuelConsumption objSpecificFuelConsumption)) throw new ArgumentException("Expected type SpecificFuelConsumption.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is SpecificFuelConsumption objSpecificFuelConsumption)) throw new ArgumentException("Expected type SpecificFuelConsumption.", nameof(obj)); return CompareTo(objSpecificFuelConsumption); } @@ -570,7 +569,7 @@ public int CompareTo(SpecificFuelConsumption other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is SpecificFuelConsumption objSpecificFuelConsumption)) + if (obj is null || !(obj is SpecificFuelConsumption objSpecificFuelConsumption)) return false; return Equals(objSpecificFuelConsumption); @@ -625,7 +624,7 @@ public bool Equals(SpecificFuelConsumption other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(SpecificFuelConsumption other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -653,7 +652,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(SpecificFuelConsumptionUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -663,13 +662,13 @@ public double As(SpecificFuelConsumptionUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -678,7 +677,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is SpecificFuelConsumptionUnit unitAsSpecificFuelConsumptionUnit)) + if (!(unit is SpecificFuelConsumptionUnit unitAsSpecificFuelConsumptionUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificFuelConsumptionUnit)} is supported.", nameof(unit)); return As(unitAsSpecificFuelConsumptionUnit); @@ -702,18 +701,18 @@ public SpecificFuelConsumption ToUnit(SpecificFuelConsumptionUnit unit) /// A SpecificFuelConsumption with the specified unit. public SpecificFuelConsumption ToUnit(SpecificFuelConsumptionUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(SpecificFuelConsumption), Unit, typeof(SpecificFuelConsumption), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(SpecificFuelConsumption), Unit, typeof(SpecificFuelConsumption), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (SpecificFuelConsumption)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -728,7 +727,7 @@ public SpecificFuelConsumption ToUnit(SpecificFuelConsumptionUnit unit, UnitConv /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is SpecificFuelConsumptionUnit unitAsSpecificFuelConsumptionUnit)) + if (!(unit is SpecificFuelConsumptionUnit unitAsSpecificFuelConsumptionUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificFuelConsumptionUnit)} is supported.", nameof(unit)); return ToUnit(unitAsSpecificFuelConsumptionUnit, DefaultConversionFunctions); @@ -737,7 +736,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is SpecificFuelConsumptionUnit unitAsSpecificFuelConsumptionUnit)) + if (!(unit is SpecificFuelConsumptionUnit unitAsSpecificFuelConsumptionUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificFuelConsumptionUnit)} is supported.", nameof(unit)); return ToUnit(unitAsSpecificFuelConsumptionUnit, unitConverter); @@ -746,13 +745,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public SpecificFuelConsumption ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -927,15 +926,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(SpecificFuelConsumption)) + if (conversionType == typeof(SpecificFuelConsumption)) return this; - else if(conversionType == typeof(SpecificFuelConsumptionUnit)) + else if (conversionType == typeof(SpecificFuelConsumptionUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return SpecificFuelConsumption.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return SpecificFuelConsumption.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return SpecificFuelConsumption.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(SpecificFuelConsumption)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs index 3c6af597a5..8c1ea13b81 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -81,7 +81,7 @@ static SpecificVolume() /// If value is NaN or Infinity. public SpecificVolume(double value, SpecificVolumeUnit unit) { - if(unit == SpecificVolumeUnit.Undefined) + if (unit == SpecificVolumeUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -98,7 +98,7 @@ public SpecificVolume(double value, SpecificVolumeUnit unit) /// No unit was found for the given . public SpecificVolume(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -218,7 +218,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) // Register in unit converter: BaseUnit -> SpecificVolumeUnit unitConverter.SetConversionFunction(SpecificVolumeUnit.CubicMeterPerKilogram, SpecificVolumeUnit.CubicFootPerPound, quantity => new SpecificVolume(quantity.Value*16.01846353, SpecificVolumeUnit.CubicFootPerPound)); unitConverter.SetConversionFunction(SpecificVolumeUnit.CubicMeterPerKilogram, SpecificVolumeUnit.MillicubicMeterPerKilogram, quantity => new SpecificVolume((quantity.Value) / 1e-3d, SpecificVolumeUnit.MillicubicMeterPerKilogram)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(SpecificVolumeUnit.CubicMeterPerKilogram, SpecificVolumeUnit.CubicMeterPerKilogram, quantity => quantity); @@ -533,8 +532,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Speci /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificVolume objSpecificVolume)) throw new ArgumentException("Expected type SpecificVolume.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is SpecificVolume objSpecificVolume)) throw new ArgumentException("Expected type SpecificVolume.", nameof(obj)); return CompareTo(objSpecificVolume); } @@ -549,7 +548,7 @@ public int CompareTo(SpecificVolume other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is SpecificVolume objSpecificVolume)) + if (obj is null || !(obj is SpecificVolume objSpecificVolume)) return false; return Equals(objSpecificVolume); @@ -604,7 +603,7 @@ public bool Equals(SpecificVolume other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(SpecificVolume other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -632,7 +631,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(SpecificVolumeUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -642,13 +641,13 @@ public double As(SpecificVolumeUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -657,7 +656,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is SpecificVolumeUnit unitAsSpecificVolumeUnit)) + if (!(unit is SpecificVolumeUnit unitAsSpecificVolumeUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificVolumeUnit)} is supported.", nameof(unit)); return As(unitAsSpecificVolumeUnit); @@ -681,18 +680,18 @@ public SpecificVolume ToUnit(SpecificVolumeUnit unit) /// A SpecificVolume with the specified unit. public SpecificVolume ToUnit(SpecificVolumeUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(SpecificVolume), Unit, typeof(SpecificVolume), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(SpecificVolume), Unit, typeof(SpecificVolume), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (SpecificVolume)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -707,7 +706,7 @@ public SpecificVolume ToUnit(SpecificVolumeUnit unit, UnitConverter unitConverte /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is SpecificVolumeUnit unitAsSpecificVolumeUnit)) + if (!(unit is SpecificVolumeUnit unitAsSpecificVolumeUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificVolumeUnit)} is supported.", nameof(unit)); return ToUnit(unitAsSpecificVolumeUnit, DefaultConversionFunctions); @@ -716,7 +715,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is SpecificVolumeUnit unitAsSpecificVolumeUnit)) + if (!(unit is SpecificVolumeUnit unitAsSpecificVolumeUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificVolumeUnit)} is supported.", nameof(unit)); return ToUnit(unitAsSpecificVolumeUnit, unitConverter); @@ -725,13 +724,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public SpecificVolume ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -906,15 +905,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(SpecificVolume)) + if (conversionType == typeof(SpecificVolume)) return this; - else if(conversionType == typeof(SpecificVolumeUnit)) + else if (conversionType == typeof(SpecificVolumeUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return SpecificVolume.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return SpecificVolume.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return SpecificVolume.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs index e38b00b15c..0ad8940d16 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -98,7 +98,7 @@ static SpecificWeight() /// If value is NaN or Infinity. public SpecificWeight(double value, SpecificWeightUnit unit) { - if(unit == SpecificWeightUnit.Undefined) + if (unit == SpecificWeightUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -115,7 +115,7 @@ public SpecificWeight(double value, SpecificWeightUnit unit) /// No unit was found for the given . public SpecificWeight(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -319,7 +319,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(SpecificWeightUnit.NewtonPerCubicMeter, SpecificWeightUnit.TonneForcePerCubicCentimeter, quantity => new SpecificWeight(quantity.Value/9.80665e9, SpecificWeightUnit.TonneForcePerCubicCentimeter)); unitConverter.SetConversionFunction(SpecificWeightUnit.NewtonPerCubicMeter, SpecificWeightUnit.TonneForcePerCubicMeter, quantity => new SpecificWeight(quantity.Value/9.80665e3, SpecificWeightUnit.TonneForcePerCubicMeter)); unitConverter.SetConversionFunction(SpecificWeightUnit.NewtonPerCubicMeter, SpecificWeightUnit.TonneForcePerCubicMillimeter, quantity => new SpecificWeight(quantity.Value/9.80665e12, SpecificWeightUnit.TonneForcePerCubicMillimeter)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(SpecificWeightUnit.NewtonPerCubicMeter, SpecificWeightUnit.NewtonPerCubicMeter, quantity => quantity); @@ -788,8 +787,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Speci /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificWeight objSpecificWeight)) throw new ArgumentException("Expected type SpecificWeight.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is SpecificWeight objSpecificWeight)) throw new ArgumentException("Expected type SpecificWeight.", nameof(obj)); return CompareTo(objSpecificWeight); } @@ -804,7 +803,7 @@ public int CompareTo(SpecificWeight other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is SpecificWeight objSpecificWeight)) + if (obj is null || !(obj is SpecificWeight objSpecificWeight)) return false; return Equals(objSpecificWeight); @@ -859,7 +858,7 @@ public bool Equals(SpecificWeight other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(SpecificWeight other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -887,7 +886,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(SpecificWeightUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -897,13 +896,13 @@ public double As(SpecificWeightUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -912,7 +911,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is SpecificWeightUnit unitAsSpecificWeightUnit)) + if (!(unit is SpecificWeightUnit unitAsSpecificWeightUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificWeightUnit)} is supported.", nameof(unit)); return As(unitAsSpecificWeightUnit); @@ -936,18 +935,18 @@ public SpecificWeight ToUnit(SpecificWeightUnit unit) /// A SpecificWeight with the specified unit. public SpecificWeight ToUnit(SpecificWeightUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(SpecificWeight), Unit, typeof(SpecificWeight), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(SpecificWeight), Unit, typeof(SpecificWeight), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (SpecificWeight)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -962,7 +961,7 @@ public SpecificWeight ToUnit(SpecificWeightUnit unit, UnitConverter unitConverte /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is SpecificWeightUnit unitAsSpecificWeightUnit)) + if (!(unit is SpecificWeightUnit unitAsSpecificWeightUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificWeightUnit)} is supported.", nameof(unit)); return ToUnit(unitAsSpecificWeightUnit, DefaultConversionFunctions); @@ -971,7 +970,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is SpecificWeightUnit unitAsSpecificWeightUnit)) + if (!(unit is SpecificWeightUnit unitAsSpecificWeightUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificWeightUnit)} is supported.", nameof(unit)); return ToUnit(unitAsSpecificWeightUnit, unitConverter); @@ -980,13 +979,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public SpecificWeight ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1161,15 +1160,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(SpecificWeight)) + if (conversionType == typeof(SpecificWeight)) return this; - else if(conversionType == typeof(SpecificWeightUnit)) + else if (conversionType == typeof(SpecificWeightUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return SpecificWeight.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return SpecificWeight.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return SpecificWeight.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs index 776ff04587..34885e2801 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs @@ -110,7 +110,7 @@ static Speed() /// If value is NaN or Infinity. public Speed(double value, SpeedUnit unit) { - if(unit == SpeedUnit.Undefined) + if (unit == SpeedUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -127,7 +127,7 @@ public Speed(double value, SpeedUnit unit) /// No unit was found for the given . public Speed(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -421,7 +421,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(SpeedUnit.MeterPerSecond, SpeedUnit.YardPerHour, quantity => new Speed(quantity.Value/0.9144*3600, SpeedUnit.YardPerHour)); unitConverter.SetConversionFunction(SpeedUnit.MeterPerSecond, SpeedUnit.YardPerMinute, quantity => new Speed(quantity.Value/0.9144*60, SpeedUnit.YardPerMinute)); unitConverter.SetConversionFunction(SpeedUnit.MeterPerSecond, SpeedUnit.YardPerSecond, quantity => new Speed(quantity.Value/0.9144, SpeedUnit.YardPerSecond)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(SpeedUnit.MeterPerSecond, SpeedUnit.MeterPerSecond, quantity => quantity); @@ -1078,8 +1077,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Speed /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Speed objSpeed)) throw new ArgumentException("Expected type Speed.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Speed objSpeed)) throw new ArgumentException("Expected type Speed.", nameof(obj)); return CompareTo(objSpeed); } @@ -1094,7 +1093,7 @@ public int CompareTo(Speed other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Speed objSpeed)) + if (obj is null || !(obj is Speed objSpeed)) return false; return Equals(objSpeed); @@ -1149,7 +1148,7 @@ public bool Equals(Speed other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Speed other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1177,7 +1176,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(SpeedUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1187,13 +1186,13 @@ public double As(SpeedUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1202,7 +1201,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is SpeedUnit unitAsSpeedUnit)) + if (!(unit is SpeedUnit unitAsSpeedUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpeedUnit)} is supported.", nameof(unit)); return As(unitAsSpeedUnit); @@ -1226,18 +1225,18 @@ public Speed ToUnit(SpeedUnit unit) /// A Speed with the specified unit. public Speed ToUnit(SpeedUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Speed), Unit, typeof(Speed), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Speed), Unit, typeof(Speed), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Speed)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1252,7 +1251,7 @@ public Speed ToUnit(SpeedUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is SpeedUnit unitAsSpeedUnit)) + if (!(unit is SpeedUnit unitAsSpeedUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpeedUnit)} is supported.", nameof(unit)); return ToUnit(unitAsSpeedUnit, DefaultConversionFunctions); @@ -1261,7 +1260,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is SpeedUnit unitAsSpeedUnit)) + if (!(unit is SpeedUnit unitAsSpeedUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpeedUnit)} is supported.", nameof(unit)); return ToUnit(unitAsSpeedUnit, unitConverter); @@ -1270,13 +1269,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Speed ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1451,15 +1450,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Speed)) + if (conversionType == typeof(Speed)) return this; - else if(conversionType == typeof(SpeedUnit)) + else if (conversionType == typeof(SpeedUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Speed.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Speed.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Speed.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Speed)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs index 7fb466f20c..da5b24c410 100644 --- a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs @@ -87,7 +87,7 @@ static StandardVolumeFlow() /// If value is NaN or Infinity. public StandardVolumeFlow(double value, StandardVolumeFlowUnit unit) { - if(unit == StandardVolumeFlowUnit.Undefined) + if (unit == StandardVolumeFlowUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -104,7 +104,7 @@ public StandardVolumeFlow(double value, StandardVolumeFlowUnit unit) /// No unit was found for the given . public StandardVolumeFlow(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -260,7 +260,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(StandardVolumeFlowUnit.StandardCubicMeterPerSecond, StandardVolumeFlowUnit.StandardCubicMeterPerHour, quantity => new StandardVolumeFlow(quantity.Value*3600, StandardVolumeFlowUnit.StandardCubicMeterPerHour)); unitConverter.SetConversionFunction(StandardVolumeFlowUnit.StandardCubicMeterPerSecond, StandardVolumeFlowUnit.StandardCubicMeterPerMinute, quantity => new StandardVolumeFlow(quantity.Value*60, StandardVolumeFlowUnit.StandardCubicMeterPerMinute)); unitConverter.SetConversionFunction(StandardVolumeFlowUnit.StandardCubicMeterPerSecond, StandardVolumeFlowUnit.StandardLiterPerMinute, quantity => new StandardVolumeFlow(quantity.Value*60000, StandardVolumeFlowUnit.StandardLiterPerMinute)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(StandardVolumeFlowUnit.StandardCubicMeterPerSecond, StandardVolumeFlowUnit.StandardCubicMeterPerSecond, quantity => quantity); @@ -641,8 +640,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Stand /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is StandardVolumeFlow objStandardVolumeFlow)) throw new ArgumentException("Expected type StandardVolumeFlow.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is StandardVolumeFlow objStandardVolumeFlow)) throw new ArgumentException("Expected type StandardVolumeFlow.", nameof(obj)); return CompareTo(objStandardVolumeFlow); } @@ -657,7 +656,7 @@ public int CompareTo(StandardVolumeFlow other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is StandardVolumeFlow objStandardVolumeFlow)) + if (obj is null || !(obj is StandardVolumeFlow objStandardVolumeFlow)) return false; return Equals(objStandardVolumeFlow); @@ -712,7 +711,7 @@ public bool Equals(StandardVolumeFlow other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(StandardVolumeFlow other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -740,7 +739,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(StandardVolumeFlowUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -750,13 +749,13 @@ public double As(StandardVolumeFlowUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -765,7 +764,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is StandardVolumeFlowUnit unitAsStandardVolumeFlowUnit)) + if (!(unit is StandardVolumeFlowUnit unitAsStandardVolumeFlowUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(StandardVolumeFlowUnit)} is supported.", nameof(unit)); return As(unitAsStandardVolumeFlowUnit); @@ -789,18 +788,18 @@ public StandardVolumeFlow ToUnit(StandardVolumeFlowUnit unit) /// A StandardVolumeFlow with the specified unit. public StandardVolumeFlow ToUnit(StandardVolumeFlowUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(StandardVolumeFlow), Unit, typeof(StandardVolumeFlow), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(StandardVolumeFlow), Unit, typeof(StandardVolumeFlow), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (StandardVolumeFlow)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -815,7 +814,7 @@ public StandardVolumeFlow ToUnit(StandardVolumeFlowUnit unit, UnitConverter unit /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is StandardVolumeFlowUnit unitAsStandardVolumeFlowUnit)) + if (!(unit is StandardVolumeFlowUnit unitAsStandardVolumeFlowUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(StandardVolumeFlowUnit)} is supported.", nameof(unit)); return ToUnit(unitAsStandardVolumeFlowUnit, DefaultConversionFunctions); @@ -824,7 +823,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is StandardVolumeFlowUnit unitAsStandardVolumeFlowUnit)) + if (!(unit is StandardVolumeFlowUnit unitAsStandardVolumeFlowUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(StandardVolumeFlowUnit)} is supported.", nameof(unit)); return ToUnit(unitAsStandardVolumeFlowUnit, unitConverter); @@ -833,13 +832,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public StandardVolumeFlow ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1014,15 +1013,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(StandardVolumeFlow)) + if (conversionType == typeof(StandardVolumeFlow)) return this; - else if(conversionType == typeof(StandardVolumeFlowUnit)) + else if (conversionType == typeof(StandardVolumeFlowUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return StandardVolumeFlow.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return StandardVolumeFlow.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return StandardVolumeFlow.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(StandardVolumeFlow)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs index 3b0205fbf6..1f0de22992 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs @@ -88,7 +88,7 @@ static Temperature() /// If value is NaN or Infinity. public Temperature(double value, TemperatureUnit unit) { - if(unit == TemperatureUnit.Undefined) + if (unit == TemperatureUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -105,7 +105,7 @@ public Temperature(double value, TemperatureUnit unit) /// No unit was found for the given . public Temperature(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -267,7 +267,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(TemperatureUnit.Kelvin, TemperatureUnit.DegreeRoemer, quantity => new Temperature((quantity.Value - (273.15 - 7.5*40d/21))*21/40, TemperatureUnit.DegreeRoemer)); unitConverter.SetConversionFunction(TemperatureUnit.Kelvin, TemperatureUnit.MillidegreeCelsius, quantity => new Temperature((quantity.Value - 273.15) * 1000, TemperatureUnit.MillidegreeCelsius)); unitConverter.SetConversionFunction(TemperatureUnit.Kelvin, TemperatureUnit.SolarTemperature, quantity => new Temperature(quantity.Value / 5778, TemperatureUnit.SolarTemperature)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(TemperatureUnit.Kelvin, TemperatureUnit.Kelvin, quantity => quantity); @@ -613,8 +612,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Tempe /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Temperature objTemperature)) throw new ArgumentException("Expected type Temperature.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Temperature objTemperature)) throw new ArgumentException("Expected type Temperature.", nameof(obj)); return CompareTo(objTemperature); } @@ -629,7 +628,7 @@ public int CompareTo(Temperature other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Temperature objTemperature)) + if (obj is null || !(obj is Temperature objTemperature)) return false; return Equals(objTemperature); @@ -684,7 +683,7 @@ public bool Equals(Temperature other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Temperature other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -712,7 +711,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(TemperatureUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -722,13 +721,13 @@ public double As(TemperatureUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -737,7 +736,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is TemperatureUnit unitAsTemperatureUnit)) + if (!(unit is TemperatureUnit unitAsTemperatureUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureUnit)} is supported.", nameof(unit)); return As(unitAsTemperatureUnit); @@ -761,18 +760,18 @@ public Temperature ToUnit(TemperatureUnit unit) /// A Temperature with the specified unit. public Temperature ToUnit(TemperatureUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Temperature), Unit, typeof(Temperature), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Temperature), Unit, typeof(Temperature), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Temperature)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -787,7 +786,7 @@ public Temperature ToUnit(TemperatureUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is TemperatureUnit unitAsTemperatureUnit)) + if (!(unit is TemperatureUnit unitAsTemperatureUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureUnit)} is supported.", nameof(unit)); return ToUnit(unitAsTemperatureUnit, DefaultConversionFunctions); @@ -796,7 +795,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is TemperatureUnit unitAsTemperatureUnit)) + if (!(unit is TemperatureUnit unitAsTemperatureUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureUnit)} is supported.", nameof(unit)); return ToUnit(unitAsTemperatureUnit, unitConverter); @@ -805,13 +804,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Temperature ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -986,15 +985,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Temperature)) + if (conversionType == typeof(Temperature)) return this; - else if(conversionType == typeof(TemperatureUnit)) + else if (conversionType == typeof(TemperatureUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Temperature.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Temperature.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Temperature.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Temperature)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs index e9bfef8d87..3a4b0b1990 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -88,7 +88,7 @@ static TemperatureChangeRate() /// If value is NaN or Infinity. public TemperatureChangeRate(double value, TemperatureChangeRateUnit unit) { - if(unit == TemperatureChangeRateUnit.Undefined) + if (unit == TemperatureChangeRateUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -105,7 +105,7 @@ public TemperatureChangeRate(double value, TemperatureChangeRateUnit unit) /// No unit was found for the given . public TemperatureChangeRate(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -267,7 +267,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(TemperatureChangeRateUnit.DegreeCelsiusPerSecond, TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond, quantity => new TemperatureChangeRate((quantity.Value) / 1e-6d, TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond)); unitConverter.SetConversionFunction(TemperatureChangeRateUnit.DegreeCelsiusPerSecond, TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond, quantity => new TemperatureChangeRate((quantity.Value) / 1e-3d, TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond)); unitConverter.SetConversionFunction(TemperatureChangeRateUnit.DegreeCelsiusPerSecond, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond, quantity => new TemperatureChangeRate((quantity.Value) / 1e-9d, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(TemperatureChangeRateUnit.DegreeCelsiusPerSecond, TemperatureChangeRateUnit.DegreeCelsiusPerSecond, quantity => quantity); @@ -659,8 +658,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Tempe /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is TemperatureChangeRate objTemperatureChangeRate)) throw new ArgumentException("Expected type TemperatureChangeRate.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is TemperatureChangeRate objTemperatureChangeRate)) throw new ArgumentException("Expected type TemperatureChangeRate.", nameof(obj)); return CompareTo(objTemperatureChangeRate); } @@ -675,7 +674,7 @@ public int CompareTo(TemperatureChangeRate other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is TemperatureChangeRate objTemperatureChangeRate)) + if (obj is null || !(obj is TemperatureChangeRate objTemperatureChangeRate)) return false; return Equals(objTemperatureChangeRate); @@ -730,7 +729,7 @@ public bool Equals(TemperatureChangeRate other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(TemperatureChangeRate other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -758,7 +757,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(TemperatureChangeRateUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -768,13 +767,13 @@ public double As(TemperatureChangeRateUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -783,7 +782,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is TemperatureChangeRateUnit unitAsTemperatureChangeRateUnit)) + if (!(unit is TemperatureChangeRateUnit unitAsTemperatureChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureChangeRateUnit)} is supported.", nameof(unit)); return As(unitAsTemperatureChangeRateUnit); @@ -807,18 +806,18 @@ public TemperatureChangeRate ToUnit(TemperatureChangeRateUnit unit) /// A TemperatureChangeRate with the specified unit. public TemperatureChangeRate ToUnit(TemperatureChangeRateUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(TemperatureChangeRate), Unit, typeof(TemperatureChangeRate), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(TemperatureChangeRate), Unit, typeof(TemperatureChangeRate), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (TemperatureChangeRate)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -833,7 +832,7 @@ public TemperatureChangeRate ToUnit(TemperatureChangeRateUnit unit, UnitConverte /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is TemperatureChangeRateUnit unitAsTemperatureChangeRateUnit)) + if (!(unit is TemperatureChangeRateUnit unitAsTemperatureChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureChangeRateUnit)} is supported.", nameof(unit)); return ToUnit(unitAsTemperatureChangeRateUnit, DefaultConversionFunctions); @@ -842,7 +841,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is TemperatureChangeRateUnit unitAsTemperatureChangeRateUnit)) + if (!(unit is TemperatureChangeRateUnit unitAsTemperatureChangeRateUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureChangeRateUnit)} is supported.", nameof(unit)); return ToUnit(unitAsTemperatureChangeRateUnit, unitConverter); @@ -851,13 +850,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public TemperatureChangeRate ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1032,15 +1031,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(TemperatureChangeRate)) + if (conversionType == typeof(TemperatureChangeRate)) return this; - else if(conversionType == typeof(TemperatureChangeRateUnit)) + else if (conversionType == typeof(TemperatureChangeRateUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return TemperatureChangeRate.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return TemperatureChangeRate.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return TemperatureChangeRate.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs index a1c0d53fce..cabc3d8cc1 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -87,7 +87,7 @@ static TemperatureDelta() /// If value is NaN or Infinity. public TemperatureDelta(double value, TemperatureDeltaUnit unit) { - if(unit == TemperatureDeltaUnit.Undefined) + if (unit == TemperatureDeltaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -104,7 +104,7 @@ public TemperatureDelta(double value, TemperatureDeltaUnit unit) /// No unit was found for the given . public TemperatureDelta(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -260,7 +260,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(TemperatureDeltaUnit.Kelvin, TemperatureDeltaUnit.DegreeReaumur, quantity => new TemperatureDelta(quantity.Value*4/5, TemperatureDeltaUnit.DegreeReaumur)); unitConverter.SetConversionFunction(TemperatureDeltaUnit.Kelvin, TemperatureDeltaUnit.DegreeRoemer, quantity => new TemperatureDelta(quantity.Value*21/40, TemperatureDeltaUnit.DegreeRoemer)); unitConverter.SetConversionFunction(TemperatureDeltaUnit.Kelvin, TemperatureDeltaUnit.MillidegreeCelsius, quantity => new TemperatureDelta((quantity.Value) / 1e-3d, TemperatureDeltaUnit.MillidegreeCelsius)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(TemperatureDeltaUnit.Kelvin, TemperatureDeltaUnit.Kelvin, quantity => quantity); @@ -641,8 +640,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Tempe /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is TemperatureDelta objTemperatureDelta)) throw new ArgumentException("Expected type TemperatureDelta.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is TemperatureDelta objTemperatureDelta)) throw new ArgumentException("Expected type TemperatureDelta.", nameof(obj)); return CompareTo(objTemperatureDelta); } @@ -657,7 +656,7 @@ public int CompareTo(TemperatureDelta other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is TemperatureDelta objTemperatureDelta)) + if (obj is null || !(obj is TemperatureDelta objTemperatureDelta)) return false; return Equals(objTemperatureDelta); @@ -712,7 +711,7 @@ public bool Equals(TemperatureDelta other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(TemperatureDelta other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -740,7 +739,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(TemperatureDeltaUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -750,13 +749,13 @@ public double As(TemperatureDeltaUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -765,7 +764,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is TemperatureDeltaUnit unitAsTemperatureDeltaUnit)) + if (!(unit is TemperatureDeltaUnit unitAsTemperatureDeltaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureDeltaUnit)} is supported.", nameof(unit)); return As(unitAsTemperatureDeltaUnit); @@ -789,18 +788,18 @@ public TemperatureDelta ToUnit(TemperatureDeltaUnit unit) /// A TemperatureDelta with the specified unit. public TemperatureDelta ToUnit(TemperatureDeltaUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(TemperatureDelta), Unit, typeof(TemperatureDelta), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(TemperatureDelta), Unit, typeof(TemperatureDelta), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (TemperatureDelta)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -815,7 +814,7 @@ public TemperatureDelta ToUnit(TemperatureDeltaUnit unit, UnitConverter unitConv /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is TemperatureDeltaUnit unitAsTemperatureDeltaUnit)) + if (!(unit is TemperatureDeltaUnit unitAsTemperatureDeltaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureDeltaUnit)} is supported.", nameof(unit)); return ToUnit(unitAsTemperatureDeltaUnit, DefaultConversionFunctions); @@ -824,7 +823,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is TemperatureDeltaUnit unitAsTemperatureDeltaUnit)) + if (!(unit is TemperatureDeltaUnit unitAsTemperatureDeltaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureDeltaUnit)} is supported.", nameof(unit)); return ToUnit(unitAsTemperatureDeltaUnit, unitConverter); @@ -833,13 +832,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public TemperatureDelta ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1014,15 +1013,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(TemperatureDelta)) + if (conversionType == typeof(TemperatureDelta)) return this; - else if(conversionType == typeof(TemperatureDeltaUnit)) + else if (conversionType == typeof(TemperatureDeltaUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return TemperatureDelta.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return TemperatureDelta.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return TemperatureDelta.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs index 615550b923..d9040cc925 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs @@ -82,7 +82,7 @@ static TemperatureGradient() /// If value is NaN or Infinity. public TemperatureGradient(double value, TemperatureGradientUnit unit) { - if(unit == TemperatureGradientUnit.Undefined) + if (unit == TemperatureGradientUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public TemperatureGradient(double value, TemperatureGradientUnit unit) /// No unit was found for the given . public TemperatureGradient(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -225,7 +225,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(TemperatureGradientUnit.KelvinPerMeter, TemperatureGradientUnit.DegreeCelsiusPerKilometer, quantity => new TemperatureGradient(quantity.Value * 1e3, TemperatureGradientUnit.DegreeCelsiusPerKilometer)); unitConverter.SetConversionFunction(TemperatureGradientUnit.KelvinPerMeter, TemperatureGradientUnit.DegreeCelsiusPerMeter, quantity => new TemperatureGradient(quantity.Value, TemperatureGradientUnit.DegreeCelsiusPerMeter)); unitConverter.SetConversionFunction(TemperatureGradientUnit.KelvinPerMeter, TemperatureGradientUnit.DegreeFahrenheitPerFoot, quantity => new TemperatureGradient((quantity.Value * 0.3048) * 9/5, TemperatureGradientUnit.DegreeFahrenheitPerFoot)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(TemperatureGradientUnit.KelvinPerMeter, TemperatureGradientUnit.KelvinPerMeter, quantity => quantity); @@ -551,8 +550,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Tempe /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is TemperatureGradient objTemperatureGradient)) throw new ArgumentException("Expected type TemperatureGradient.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is TemperatureGradient objTemperatureGradient)) throw new ArgumentException("Expected type TemperatureGradient.", nameof(obj)); return CompareTo(objTemperatureGradient); } @@ -567,7 +566,7 @@ public int CompareTo(TemperatureGradient other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is TemperatureGradient objTemperatureGradient)) + if (obj is null || !(obj is TemperatureGradient objTemperatureGradient)) return false; return Equals(objTemperatureGradient); @@ -622,7 +621,7 @@ public bool Equals(TemperatureGradient other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(TemperatureGradient other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -650,7 +649,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(TemperatureGradientUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -660,13 +659,13 @@ public double As(TemperatureGradientUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -675,7 +674,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is TemperatureGradientUnit unitAsTemperatureGradientUnit)) + if (!(unit is TemperatureGradientUnit unitAsTemperatureGradientUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureGradientUnit)} is supported.", nameof(unit)); return As(unitAsTemperatureGradientUnit); @@ -699,18 +698,18 @@ public TemperatureGradient ToUnit(TemperatureGradientUnit unit) /// A TemperatureGradient with the specified unit. public TemperatureGradient ToUnit(TemperatureGradientUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(TemperatureGradient), Unit, typeof(TemperatureGradient), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(TemperatureGradient), Unit, typeof(TemperatureGradient), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (TemperatureGradient)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -725,7 +724,7 @@ public TemperatureGradient ToUnit(TemperatureGradientUnit unit, UnitConverter un /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is TemperatureGradientUnit unitAsTemperatureGradientUnit)) + if (!(unit is TemperatureGradientUnit unitAsTemperatureGradientUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureGradientUnit)} is supported.", nameof(unit)); return ToUnit(unitAsTemperatureGradientUnit, DefaultConversionFunctions); @@ -734,7 +733,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is TemperatureGradientUnit unitAsTemperatureGradientUnit)) + if (!(unit is TemperatureGradientUnit unitAsTemperatureGradientUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureGradientUnit)} is supported.", nameof(unit)); return ToUnit(unitAsTemperatureGradientUnit, unitConverter); @@ -743,13 +742,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public TemperatureGradient ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -924,15 +923,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(TemperatureGradient)) + if (conversionType == typeof(TemperatureGradient)) return this; - else if(conversionType == typeof(TemperatureGradientUnit)) + else if (conversionType == typeof(TemperatureGradientUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return TemperatureGradient.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return TemperatureGradient.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return TemperatureGradient.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(TemperatureGradient)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs index cfabb4495e..b6630ac49e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs @@ -83,7 +83,7 @@ static ThermalConductivity() /// If value is NaN or Infinity. public ThermalConductivity(double value, ThermalConductivityUnit unit) { - if(unit == ThermalConductivityUnit.Undefined) + if (unit == ThermalConductivityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -100,7 +100,7 @@ public ThermalConductivity(double value, ThermalConductivityUnit unit) /// No unit was found for the given . public ThermalConductivity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -214,7 +214,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> ThermalConductivityUnit unitConverter.SetConversionFunction(ThermalConductivityUnit.WattPerMeterKelvin, ThermalConductivityUnit.BtuPerHourFootFahrenheit, quantity => new ThermalConductivity(quantity.Value/1.73073467, ThermalConductivityUnit.BtuPerHourFootFahrenheit)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ThermalConductivityUnit.WattPerMeterKelvin, ThermalConductivityUnit.WattPerMeterKelvin, quantity => quantity); @@ -518,8 +517,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Therm /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ThermalConductivity objThermalConductivity)) throw new ArgumentException("Expected type ThermalConductivity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ThermalConductivity objThermalConductivity)) throw new ArgumentException("Expected type ThermalConductivity.", nameof(obj)); return CompareTo(objThermalConductivity); } @@ -534,7 +533,7 @@ public int CompareTo(ThermalConductivity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ThermalConductivity objThermalConductivity)) + if (obj is null || !(obj is ThermalConductivity objThermalConductivity)) return false; return Equals(objThermalConductivity); @@ -589,7 +588,7 @@ public bool Equals(ThermalConductivity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ThermalConductivity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -617,7 +616,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ThermalConductivityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -627,13 +626,13 @@ public double As(ThermalConductivityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -642,7 +641,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ThermalConductivityUnit unitAsThermalConductivityUnit)) + if (!(unit is ThermalConductivityUnit unitAsThermalConductivityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ThermalConductivityUnit)} is supported.", nameof(unit)); return As(unitAsThermalConductivityUnit); @@ -666,18 +665,18 @@ public ThermalConductivity ToUnit(ThermalConductivityUnit unit) /// A ThermalConductivity with the specified unit. public ThermalConductivity ToUnit(ThermalConductivityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ThermalConductivity), Unit, typeof(ThermalConductivity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ThermalConductivity), Unit, typeof(ThermalConductivity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ThermalConductivity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -692,7 +691,7 @@ public ThermalConductivity ToUnit(ThermalConductivityUnit unit, UnitConverter un /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ThermalConductivityUnit unitAsThermalConductivityUnit)) + if (!(unit is ThermalConductivityUnit unitAsThermalConductivityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ThermalConductivityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsThermalConductivityUnit, DefaultConversionFunctions); @@ -701,7 +700,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ThermalConductivityUnit unitAsThermalConductivityUnit)) + if (!(unit is ThermalConductivityUnit unitAsThermalConductivityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ThermalConductivityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsThermalConductivityUnit, unitConverter); @@ -710,13 +709,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ThermalConductivity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -891,15 +890,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ThermalConductivity)) + if (conversionType == typeof(ThermalConductivity)) return this; - else if(conversionType == typeof(ThermalConductivityUnit)) + else if (conversionType == typeof(ThermalConductivityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ThermalConductivity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ThermalConductivity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ThermalConductivity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs index 07580a0d85..aedf0b3666 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs @@ -84,7 +84,7 @@ static ThermalResistance() /// If value is NaN or Infinity. public ThermalResistance(double value, ThermalResistanceUnit unit) { - if(unit == ThermalResistanceUnit.Undefined) + if (unit == ThermalResistanceUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -101,7 +101,7 @@ public ThermalResistance(double value, ThermalResistanceUnit unit) /// No unit was found for the given . public ThermalResistance(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -239,7 +239,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(ThermalResistanceUnit.SquareMeterKelvinPerKilowatt, ThermalResistanceUnit.SquareCentimeterKelvinPerWatt, quantity => new ThermalResistance(quantity.Value/0.0999964777570357, ThermalResistanceUnit.SquareCentimeterKelvinPerWatt)); unitConverter.SetConversionFunction(ThermalResistanceUnit.SquareMeterKelvinPerKilowatt, ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt, quantity => new ThermalResistance(quantity.Value/1000.088056074108, ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt)); unitConverter.SetConversionFunction(ThermalResistanceUnit.SquareMeterKelvinPerKilowatt, ThermalResistanceUnit.SquareMeterKelvinPerWatt, quantity => new ThermalResistance(quantity.Value/1000, ThermalResistanceUnit.SquareMeterKelvinPerWatt)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(ThermalResistanceUnit.SquareMeterKelvinPerKilowatt, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt, quantity => quantity); @@ -587,8 +586,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Therm /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ThermalResistance objThermalResistance)) throw new ArgumentException("Expected type ThermalResistance.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is ThermalResistance objThermalResistance)) throw new ArgumentException("Expected type ThermalResistance.", nameof(obj)); return CompareTo(objThermalResistance); } @@ -603,7 +602,7 @@ public int CompareTo(ThermalResistance other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is ThermalResistance objThermalResistance)) + if (obj is null || !(obj is ThermalResistance objThermalResistance)) return false; return Equals(objThermalResistance); @@ -658,7 +657,7 @@ public bool Equals(ThermalResistance other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(ThermalResistance other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -686,7 +685,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(ThermalResistanceUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -696,13 +695,13 @@ public double As(ThermalResistanceUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -711,7 +710,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is ThermalResistanceUnit unitAsThermalResistanceUnit)) + if (!(unit is ThermalResistanceUnit unitAsThermalResistanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ThermalResistanceUnit)} is supported.", nameof(unit)); return As(unitAsThermalResistanceUnit); @@ -735,18 +734,18 @@ public ThermalResistance ToUnit(ThermalResistanceUnit unit) /// A ThermalResistance with the specified unit. public ThermalResistance ToUnit(ThermalResistanceUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(ThermalResistance), Unit, typeof(ThermalResistance), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(ThermalResistance), Unit, typeof(ThermalResistance), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (ThermalResistance)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -761,7 +760,7 @@ public ThermalResistance ToUnit(ThermalResistanceUnit unit, UnitConverter unitCo /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is ThermalResistanceUnit unitAsThermalResistanceUnit)) + if (!(unit is ThermalResistanceUnit unitAsThermalResistanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ThermalResistanceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsThermalResistanceUnit, DefaultConversionFunctions); @@ -770,7 +769,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is ThermalResistanceUnit unitAsThermalResistanceUnit)) + if (!(unit is ThermalResistanceUnit unitAsThermalResistanceUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ThermalResistanceUnit)} is supported.", nameof(unit)); return ToUnit(unitAsThermalResistanceUnit, unitConverter); @@ -779,13 +778,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public ThermalResistance ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -960,15 +959,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(ThermalResistance)) + if (conversionType == typeof(ThermalResistance)) return this; - else if(conversionType == typeof(ThermalResistanceUnit)) + else if (conversionType == typeof(ThermalResistanceUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return ThermalResistance.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return ThermalResistance.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return ThermalResistance.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs index 574f8a84c2..e869d59f99 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs @@ -103,7 +103,7 @@ static Torque() /// If value is NaN or Infinity. public Torque(double value, TorqueUnit unit) { - if(unit == TorqueUnit.Undefined) + if (unit == TorqueUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -120,7 +120,7 @@ public Torque(double value, TorqueUnit unit) /// No unit was found for the given . public Torque(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -372,7 +372,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(TorqueUnit.NewtonMeter, TorqueUnit.TonneForceCentimeter, quantity => new Torque(quantity.Value/9.80665e1, TorqueUnit.TonneForceCentimeter)); unitConverter.SetConversionFunction(TorqueUnit.NewtonMeter, TorqueUnit.TonneForceMeter, quantity => new Torque(quantity.Value/9.80665e3, TorqueUnit.TonneForceMeter)); unitConverter.SetConversionFunction(TorqueUnit.NewtonMeter, TorqueUnit.TonneForceMillimeter, quantity => new Torque(quantity.Value/9.80665, TorqueUnit.TonneForceMillimeter)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(TorqueUnit.NewtonMeter, TorqueUnit.NewtonMeter, quantity => quantity); @@ -932,8 +931,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Torqu /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Torque objTorque)) throw new ArgumentException("Expected type Torque.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Torque objTorque)) throw new ArgumentException("Expected type Torque.", nameof(obj)); return CompareTo(objTorque); } @@ -948,7 +947,7 @@ public int CompareTo(Torque other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Torque objTorque)) + if (obj is null || !(obj is Torque objTorque)) return false; return Equals(objTorque); @@ -1003,7 +1002,7 @@ public bool Equals(Torque other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Torque other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1031,7 +1030,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(TorqueUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1041,13 +1040,13 @@ public double As(TorqueUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1056,7 +1055,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is TorqueUnit unitAsTorqueUnit)) + if (!(unit is TorqueUnit unitAsTorqueUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TorqueUnit)} is supported.", nameof(unit)); return As(unitAsTorqueUnit); @@ -1080,18 +1079,18 @@ public Torque ToUnit(TorqueUnit unit) /// A Torque with the specified unit. public Torque ToUnit(TorqueUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Torque), Unit, typeof(Torque), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Torque), Unit, typeof(Torque), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Torque)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1106,7 +1105,7 @@ public Torque ToUnit(TorqueUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is TorqueUnit unitAsTorqueUnit)) + if (!(unit is TorqueUnit unitAsTorqueUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TorqueUnit)} is supported.", nameof(unit)); return ToUnit(unitAsTorqueUnit, DefaultConversionFunctions); @@ -1115,7 +1114,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is TorqueUnit unitAsTorqueUnit)) + if (!(unit is TorqueUnit unitAsTorqueUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TorqueUnit)} is supported.", nameof(unit)); return ToUnit(unitAsTorqueUnit, unitConverter); @@ -1124,13 +1123,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Torque ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1305,15 +1304,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Torque)) + if (conversionType == typeof(Torque)) return this; - else if(conversionType == typeof(TorqueUnit)) + else if (conversionType == typeof(TorqueUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Torque.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Torque.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Torque.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Torque)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs index acfcfa8297..d32026320c 100644 --- a/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs @@ -99,7 +99,7 @@ static TorquePerLength() /// If value is NaN or Infinity. public TorquePerLength(double value, TorquePerLengthUnit unit) { - if(unit == TorquePerLengthUnit.Undefined) + if (unit == TorquePerLengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -116,7 +116,7 @@ public TorquePerLength(double value, TorquePerLengthUnit unit) /// No unit was found for the given . public TorquePerLength(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -344,7 +344,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(TorquePerLengthUnit.NewtonMeterPerMeter, TorquePerLengthUnit.TonneForceCentimeterPerMeter, quantity => new TorquePerLength(quantity.Value*0.0101971619222242, TorquePerLengthUnit.TonneForceCentimeterPerMeter)); unitConverter.SetConversionFunction(TorquePerLengthUnit.NewtonMeterPerMeter, TorquePerLengthUnit.TonneForceMeterPerMeter, quantity => new TorquePerLength(quantity.Value*0.000101971619222242, TorquePerLengthUnit.TonneForceMeterPerMeter)); unitConverter.SetConversionFunction(TorquePerLengthUnit.NewtonMeterPerMeter, TorquePerLengthUnit.TonneForceMillimeterPerMeter, quantity => new TorquePerLength(quantity.Value*0.101971619222242, TorquePerLengthUnit.TonneForceMillimeterPerMeter)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(TorquePerLengthUnit.NewtonMeterPerMeter, TorquePerLengthUnit.NewtonMeterPerMeter, quantity => quantity); @@ -860,8 +859,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Torqu /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is TorquePerLength objTorquePerLength)) throw new ArgumentException("Expected type TorquePerLength.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is TorquePerLength objTorquePerLength)) throw new ArgumentException("Expected type TorquePerLength.", nameof(obj)); return CompareTo(objTorquePerLength); } @@ -876,7 +875,7 @@ public int CompareTo(TorquePerLength other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is TorquePerLength objTorquePerLength)) + if (obj is null || !(obj is TorquePerLength objTorquePerLength)) return false; return Equals(objTorquePerLength); @@ -931,7 +930,7 @@ public bool Equals(TorquePerLength other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(TorquePerLength other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -959,7 +958,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(TorquePerLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -969,13 +968,13 @@ public double As(TorquePerLengthUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -984,7 +983,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is TorquePerLengthUnit unitAsTorquePerLengthUnit)) + if (!(unit is TorquePerLengthUnit unitAsTorquePerLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TorquePerLengthUnit)} is supported.", nameof(unit)); return As(unitAsTorquePerLengthUnit); @@ -1008,18 +1007,18 @@ public TorquePerLength ToUnit(TorquePerLengthUnit unit) /// A TorquePerLength with the specified unit. public TorquePerLength ToUnit(TorquePerLengthUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(TorquePerLength), Unit, typeof(TorquePerLength), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(TorquePerLength), Unit, typeof(TorquePerLength), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (TorquePerLength)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1034,7 +1033,7 @@ public TorquePerLength ToUnit(TorquePerLengthUnit unit, UnitConverter unitConver /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is TorquePerLengthUnit unitAsTorquePerLengthUnit)) + if (!(unit is TorquePerLengthUnit unitAsTorquePerLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TorquePerLengthUnit)} is supported.", nameof(unit)); return ToUnit(unitAsTorquePerLengthUnit, DefaultConversionFunctions); @@ -1043,7 +1042,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is TorquePerLengthUnit unitAsTorquePerLengthUnit)) + if (!(unit is TorquePerLengthUnit unitAsTorquePerLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TorquePerLengthUnit)} is supported.", nameof(unit)); return ToUnit(unitAsTorquePerLengthUnit, unitConverter); @@ -1052,13 +1051,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public TorquePerLength ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1233,15 +1232,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(TorquePerLength)) + if (conversionType == typeof(TorquePerLength)) return this; - else if(conversionType == typeof(TorquePerLengthUnit)) + else if (conversionType == typeof(TorquePerLengthUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return TorquePerLength.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return TorquePerLength.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return TorquePerLength.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(TorquePerLength)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs index cc1198cda3..d943314572 100644 --- a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs @@ -82,7 +82,7 @@ static Turbidity() /// If value is NaN or Infinity. public Turbidity(double value, TurbidityUnit unit) { - if(unit == TurbidityUnit.Undefined) + if (unit == TurbidityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -99,7 +99,7 @@ public Turbidity(double value, TurbidityUnit unit) /// No unit was found for the given . public Turbidity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -207,7 +207,6 @@ public Turbidity(double value, UnitSystem unitSystem) internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> TurbidityUnit - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(TurbidityUnit.NTU, TurbidityUnit.NTU, quantity => quantity); @@ -500,8 +499,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Turbi /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Turbidity objTurbidity)) throw new ArgumentException("Expected type Turbidity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Turbidity objTurbidity)) throw new ArgumentException("Expected type Turbidity.", nameof(obj)); return CompareTo(objTurbidity); } @@ -516,7 +515,7 @@ public int CompareTo(Turbidity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Turbidity objTurbidity)) + if (obj is null || !(obj is Turbidity objTurbidity)) return false; return Equals(objTurbidity); @@ -571,7 +570,7 @@ public bool Equals(Turbidity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Turbidity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -599,7 +598,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(TurbidityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -609,13 +608,13 @@ public double As(TurbidityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -624,7 +623,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is TurbidityUnit unitAsTurbidityUnit)) + if (!(unit is TurbidityUnit unitAsTurbidityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TurbidityUnit)} is supported.", nameof(unit)); return As(unitAsTurbidityUnit); @@ -648,18 +647,18 @@ public Turbidity ToUnit(TurbidityUnit unit) /// A Turbidity with the specified unit. public Turbidity ToUnit(TurbidityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Turbidity), Unit, typeof(Turbidity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Turbidity), Unit, typeof(Turbidity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Turbidity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -674,7 +673,7 @@ public Turbidity ToUnit(TurbidityUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is TurbidityUnit unitAsTurbidityUnit)) + if (!(unit is TurbidityUnit unitAsTurbidityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TurbidityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsTurbidityUnit, DefaultConversionFunctions); @@ -683,7 +682,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is TurbidityUnit unitAsTurbidityUnit)) + if (!(unit is TurbidityUnit unitAsTurbidityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TurbidityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsTurbidityUnit, unitConverter); @@ -692,13 +691,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Turbidity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -873,15 +872,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Turbidity)) + if (conversionType == typeof(Turbidity)) return this; - else if(conversionType == typeof(TurbidityUnit)) + else if (conversionType == typeof(TurbidityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Turbidity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Turbidity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Turbidity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Turbidity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs index 8d554928b0..0349949e0d 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs @@ -79,7 +79,7 @@ static VitaminA() /// If value is NaN or Infinity. public VitaminA(double value, VitaminAUnit unit) { - if(unit == VitaminAUnit.Undefined) + if (unit == VitaminAUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -96,7 +96,7 @@ public VitaminA(double value, VitaminAUnit unit) /// No unit was found for the given . public VitaminA(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -204,7 +204,6 @@ public VitaminA(double value, UnitSystem unitSystem) internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> VitaminAUnit - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(VitaminAUnit.InternationalUnit, VitaminAUnit.InternationalUnit, quantity => quantity); @@ -497,8 +496,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Vitam /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VitaminA objVitaminA)) throw new ArgumentException("Expected type VitaminA.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is VitaminA objVitaminA)) throw new ArgumentException("Expected type VitaminA.", nameof(obj)); return CompareTo(objVitaminA); } @@ -513,7 +512,7 @@ public int CompareTo(VitaminA other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is VitaminA objVitaminA)) + if (obj is null || !(obj is VitaminA objVitaminA)) return false; return Equals(objVitaminA); @@ -568,7 +567,7 @@ public bool Equals(VitaminA other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(VitaminA other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -596,7 +595,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(VitaminAUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -606,13 +605,13 @@ public double As(VitaminAUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -621,7 +620,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is VitaminAUnit unitAsVitaminAUnit)) + if (!(unit is VitaminAUnit unitAsVitaminAUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VitaminAUnit)} is supported.", nameof(unit)); return As(unitAsVitaminAUnit); @@ -645,18 +644,18 @@ public VitaminA ToUnit(VitaminAUnit unit) /// A VitaminA with the specified unit. public VitaminA ToUnit(VitaminAUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(VitaminA), Unit, typeof(VitaminA), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(VitaminA), Unit, typeof(VitaminA), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (VitaminA)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -671,7 +670,7 @@ public VitaminA ToUnit(VitaminAUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is VitaminAUnit unitAsVitaminAUnit)) + if (!(unit is VitaminAUnit unitAsVitaminAUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VitaminAUnit)} is supported.", nameof(unit)); return ToUnit(unitAsVitaminAUnit, DefaultConversionFunctions); @@ -680,7 +679,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is VitaminAUnit unitAsVitaminAUnit)) + if (!(unit is VitaminAUnit unitAsVitaminAUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VitaminAUnit)} is supported.", nameof(unit)); return ToUnit(unitAsVitaminAUnit, unitConverter); @@ -689,13 +688,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public VitaminA ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -870,15 +869,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(VitaminA)) + if (conversionType == typeof(VitaminA)) return this; - else if(conversionType == typeof(VitaminAUnit)) + else if (conversionType == typeof(VitaminAUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return VitaminA.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return VitaminA.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return VitaminA.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(VitaminA)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs index b5cb37c2f2..dcd61e02cf 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -129,7 +129,7 @@ static Volume() /// If value is NaN or Infinity. public Volume(double value, VolumeUnit unit) { - if(unit == VolumeUnit.Undefined) + if (unit == VolumeUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -146,7 +146,7 @@ public Volume(double value, VolumeUnit unit) /// No unit was found for the given . public Volume(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -554,7 +554,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(VolumeUnit.CubicMeter, VolumeUnit.UsQuart, quantity => new Volume(quantity.Value/9.46352946e-4, VolumeUnit.UsQuart)); unitConverter.SetConversionFunction(VolumeUnit.CubicMeter, VolumeUnit.UsTablespoon, quantity => new Volume(quantity.Value/1.478676478125e-5, VolumeUnit.UsTablespoon)); unitConverter.SetConversionFunction(VolumeUnit.CubicMeter, VolumeUnit.UsTeaspoon, quantity => new Volume(quantity.Value/4.92892159375e-6, VolumeUnit.UsTeaspoon)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(VolumeUnit.CubicMeter, VolumeUnit.CubicMeter, quantity => quantity); @@ -1443,8 +1442,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Volum /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Volume objVolume)) throw new ArgumentException("Expected type Volume.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is Volume objVolume)) throw new ArgumentException("Expected type Volume.", nameof(obj)); return CompareTo(objVolume); } @@ -1459,7 +1458,7 @@ public int CompareTo(Volume other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is Volume objVolume)) + if (obj is null || !(obj is Volume objVolume)) return false; return Equals(objVolume); @@ -1514,7 +1513,7 @@ public bool Equals(Volume other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(Volume other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1542,7 +1541,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(VolumeUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1552,13 +1551,13 @@ public double As(VolumeUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1567,7 +1566,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is VolumeUnit unitAsVolumeUnit)) + if (!(unit is VolumeUnit unitAsVolumeUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeUnit)} is supported.", nameof(unit)); return As(unitAsVolumeUnit); @@ -1591,18 +1590,18 @@ public Volume ToUnit(VolumeUnit unit) /// A Volume with the specified unit. public Volume ToUnit(VolumeUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(Volume), Unit, typeof(Volume), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(Volume), Unit, typeof(Volume), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (Volume)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1617,7 +1616,7 @@ public Volume ToUnit(VolumeUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is VolumeUnit unitAsVolumeUnit)) + if (!(unit is VolumeUnit unitAsVolumeUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeUnit)} is supported.", nameof(unit)); return ToUnit(unitAsVolumeUnit, DefaultConversionFunctions); @@ -1626,7 +1625,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is VolumeUnit unitAsVolumeUnit)) + if (!(unit is VolumeUnit unitAsVolumeUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeUnit)} is supported.", nameof(unit)); return ToUnit(unitAsVolumeUnit, unitConverter); @@ -1635,13 +1634,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public Volume ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1816,15 +1815,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(Volume)) + if (conversionType == typeof(Volume)) return this; - else if(conversionType == typeof(VolumeUnit)) + else if (conversionType == typeof(VolumeUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return Volume.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return Volume.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return Volume.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(Volume)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs index b58221b595..ffa8aa0364 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs @@ -101,7 +101,7 @@ static VolumeConcentration() /// If value is NaN or Infinity. public VolumeConcentration(double value, VolumeConcentrationUnit unit) { - if(unit == VolumeConcentrationUnit.Undefined) + if (unit == VolumeConcentrationUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -118,7 +118,7 @@ public VolumeConcentration(double value, VolumeConcentrationUnit unit) /// No unit was found for the given . public VolumeConcentration(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -340,7 +340,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(VolumeConcentrationUnit.DecimalFraction, VolumeConcentrationUnit.Percent, quantity => new VolumeConcentration(quantity.Value*1e2, VolumeConcentrationUnit.Percent)); unitConverter.SetConversionFunction(VolumeConcentrationUnit.DecimalFraction, VolumeConcentrationUnit.PicolitersPerLiter, quantity => new VolumeConcentration((quantity.Value) / 1e-12d, VolumeConcentrationUnit.PicolitersPerLiter)); unitConverter.SetConversionFunction(VolumeConcentrationUnit.DecimalFraction, VolumeConcentrationUnit.PicolitersPerMililiter, quantity => new VolumeConcentration((quantity.Value*1e-3) / 1e-12d, VolumeConcentrationUnit.PicolitersPerMililiter)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(VolumeConcentrationUnit.DecimalFraction, VolumeConcentrationUnit.DecimalFraction, quantity => quantity); @@ -842,8 +841,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Volum /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumeConcentration objVolumeConcentration)) throw new ArgumentException("Expected type VolumeConcentration.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is VolumeConcentration objVolumeConcentration)) throw new ArgumentException("Expected type VolumeConcentration.", nameof(obj)); return CompareTo(objVolumeConcentration); } @@ -858,7 +857,7 @@ public int CompareTo(VolumeConcentration other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is VolumeConcentration objVolumeConcentration)) + if (obj is null || !(obj is VolumeConcentration objVolumeConcentration)) return false; return Equals(objVolumeConcentration); @@ -913,7 +912,7 @@ public bool Equals(VolumeConcentration other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(VolumeConcentration other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -941,7 +940,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(VolumeConcentrationUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -951,13 +950,13 @@ public double As(VolumeConcentrationUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -966,7 +965,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is VolumeConcentrationUnit unitAsVolumeConcentrationUnit)) + if (!(unit is VolumeConcentrationUnit unitAsVolumeConcentrationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeConcentrationUnit)} is supported.", nameof(unit)); return As(unitAsVolumeConcentrationUnit); @@ -990,18 +989,18 @@ public VolumeConcentration ToUnit(VolumeConcentrationUnit unit) /// A VolumeConcentration with the specified unit. public VolumeConcentration ToUnit(VolumeConcentrationUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(VolumeConcentration), Unit, typeof(VolumeConcentration), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(VolumeConcentration), Unit, typeof(VolumeConcentration), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (VolumeConcentration)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1016,7 +1015,7 @@ public VolumeConcentration ToUnit(VolumeConcentrationUnit unit, UnitConverter un /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is VolumeConcentrationUnit unitAsVolumeConcentrationUnit)) + if (!(unit is VolumeConcentrationUnit unitAsVolumeConcentrationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeConcentrationUnit)} is supported.", nameof(unit)); return ToUnit(unitAsVolumeConcentrationUnit, DefaultConversionFunctions); @@ -1025,7 +1024,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is VolumeConcentrationUnit unitAsVolumeConcentrationUnit)) + if (!(unit is VolumeConcentrationUnit unitAsVolumeConcentrationUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeConcentrationUnit)} is supported.", nameof(unit)); return ToUnit(unitAsVolumeConcentrationUnit, unitConverter); @@ -1034,13 +1033,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public VolumeConcentration ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1215,15 +1214,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(VolumeConcentration)) + if (conversionType == typeof(VolumeConcentration)) return this; - else if(conversionType == typeof(VolumeConcentrationUnit)) + else if (conversionType == typeof(VolumeConcentrationUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return VolumeConcentration.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return VolumeConcentration.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return VolumeConcentration.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(VolumeConcentration)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs index 266b5c9ddc..461492c415 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -140,7 +140,7 @@ static VolumeFlow() /// If value is NaN or Infinity. public VolumeFlow(double value, VolumeFlowUnit unit) { - if(unit == VolumeFlowUnit.Undefined) + if (unit == VolumeFlowUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -157,7 +157,7 @@ public VolumeFlow(double value, VolumeFlowUnit unit) /// No unit was found for the given . public VolumeFlow(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -631,7 +631,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.UsGallonPerHour, quantity => new VolumeFlow(quantity.Value*951019.38848933424, VolumeFlowUnit.UsGallonPerHour)); unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.UsGallonPerMinute, quantity => new VolumeFlow(quantity.Value*15850.323141489, VolumeFlowUnit.UsGallonPerMinute)); unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.UsGallonPerSecond, quantity => new VolumeFlow(quantity.Value*264.1720523581484, VolumeFlowUnit.UsGallonPerSecond)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(VolumeFlowUnit.CubicMeterPerSecond, VolumeFlowUnit.CubicMeterPerSecond, quantity => quantity); @@ -1622,8 +1621,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Volum /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumeFlow objVolumeFlow)) throw new ArgumentException("Expected type VolumeFlow.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is VolumeFlow objVolumeFlow)) throw new ArgumentException("Expected type VolumeFlow.", nameof(obj)); return CompareTo(objVolumeFlow); } @@ -1638,7 +1637,7 @@ public int CompareTo(VolumeFlow other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is VolumeFlow objVolumeFlow)) + if (obj is null || !(obj is VolumeFlow objVolumeFlow)) return false; return Equals(objVolumeFlow); @@ -1693,7 +1692,7 @@ public bool Equals(VolumeFlow other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(VolumeFlow other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -1721,7 +1720,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(VolumeFlowUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -1731,13 +1730,13 @@ public double As(VolumeFlowUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -1746,7 +1745,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is VolumeFlowUnit unitAsVolumeFlowUnit)) + if (!(unit is VolumeFlowUnit unitAsVolumeFlowUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeFlowUnit)} is supported.", nameof(unit)); return As(unitAsVolumeFlowUnit); @@ -1770,18 +1769,18 @@ public VolumeFlow ToUnit(VolumeFlowUnit unit) /// A VolumeFlow with the specified unit. public VolumeFlow ToUnit(VolumeFlowUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(VolumeFlow), Unit, typeof(VolumeFlow), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(VolumeFlow), Unit, typeof(VolumeFlow), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (VolumeFlow)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -1796,7 +1795,7 @@ public VolumeFlow ToUnit(VolumeFlowUnit unit, UnitConverter unitConverter) /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is VolumeFlowUnit unitAsVolumeFlowUnit)) + if (!(unit is VolumeFlowUnit unitAsVolumeFlowUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeFlowUnit)} is supported.", nameof(unit)); return ToUnit(unitAsVolumeFlowUnit, DefaultConversionFunctions); @@ -1805,7 +1804,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is VolumeFlowUnit unitAsVolumeFlowUnit)) + if (!(unit is VolumeFlowUnit unitAsVolumeFlowUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeFlowUnit)} is supported.", nameof(unit)); return ToUnit(unitAsVolumeFlowUnit, unitConverter); @@ -1814,13 +1813,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public VolumeFlow ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1995,15 +1994,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(VolumeFlow)) + if (conversionType == typeof(VolumeFlow)) return this; - else if(conversionType == typeof(VolumeFlowUnit)) + else if (conversionType == typeof(VolumeFlowUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return VolumeFlow.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return VolumeFlow.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return VolumeFlow.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs index c91b88335e..c533490cc4 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs @@ -80,7 +80,7 @@ static VolumeFlowPerArea() /// If value is NaN or Infinity. public VolumeFlowPerArea(double value, VolumeFlowPerAreaUnit unit) { - if(unit == VolumeFlowPerAreaUnit.Undefined) + if (unit == VolumeFlowPerAreaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -97,7 +97,7 @@ public VolumeFlowPerArea(double value, VolumeFlowPerAreaUnit unit) /// No unit was found for the given . public VolumeFlowPerArea(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -211,7 +211,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) { // Register in unit converter: BaseUnit -> VolumeFlowPerAreaUnit unitConverter.SetConversionFunction(VolumeFlowPerAreaUnit.CubicMeterPerSecondPerSquareMeter, VolumeFlowPerAreaUnit.CubicFootPerMinutePerSquareFoot, quantity => new VolumeFlowPerArea(quantity.Value*196.850394, VolumeFlowPerAreaUnit.CubicFootPerMinutePerSquareFoot)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(VolumeFlowPerAreaUnit.CubicMeterPerSecondPerSquareMeter, VolumeFlowPerAreaUnit.CubicMeterPerSecondPerSquareMeter, quantity => quantity); @@ -515,8 +514,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Volum /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumeFlowPerArea objVolumeFlowPerArea)) throw new ArgumentException("Expected type VolumeFlowPerArea.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is VolumeFlowPerArea objVolumeFlowPerArea)) throw new ArgumentException("Expected type VolumeFlowPerArea.", nameof(obj)); return CompareTo(objVolumeFlowPerArea); } @@ -531,7 +530,7 @@ public int CompareTo(VolumeFlowPerArea other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is VolumeFlowPerArea objVolumeFlowPerArea)) + if (obj is null || !(obj is VolumeFlowPerArea objVolumeFlowPerArea)) return false; return Equals(objVolumeFlowPerArea); @@ -586,7 +585,7 @@ public bool Equals(VolumeFlowPerArea other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(VolumeFlowPerArea other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -614,7 +613,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(VolumeFlowPerAreaUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -624,13 +623,13 @@ public double As(VolumeFlowPerAreaUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -639,7 +638,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is VolumeFlowPerAreaUnit unitAsVolumeFlowPerAreaUnit)) + if (!(unit is VolumeFlowPerAreaUnit unitAsVolumeFlowPerAreaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeFlowPerAreaUnit)} is supported.", nameof(unit)); return As(unitAsVolumeFlowPerAreaUnit); @@ -663,18 +662,18 @@ public VolumeFlowPerArea ToUnit(VolumeFlowPerAreaUnit unit) /// A VolumeFlowPerArea with the specified unit. public VolumeFlowPerArea ToUnit(VolumeFlowPerAreaUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(VolumeFlowPerArea), Unit, typeof(VolumeFlowPerArea), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(VolumeFlowPerArea), Unit, typeof(VolumeFlowPerArea), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (VolumeFlowPerArea)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -689,7 +688,7 @@ public VolumeFlowPerArea ToUnit(VolumeFlowPerAreaUnit unit, UnitConverter unitCo /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is VolumeFlowPerAreaUnit unitAsVolumeFlowPerAreaUnit)) + if (!(unit is VolumeFlowPerAreaUnit unitAsVolumeFlowPerAreaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeFlowPerAreaUnit)} is supported.", nameof(unit)); return ToUnit(unitAsVolumeFlowPerAreaUnit, DefaultConversionFunctions); @@ -698,7 +697,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is VolumeFlowPerAreaUnit unitAsVolumeFlowPerAreaUnit)) + if (!(unit is VolumeFlowPerAreaUnit unitAsVolumeFlowPerAreaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeFlowPerAreaUnit)} is supported.", nameof(unit)); return ToUnit(unitAsVolumeFlowPerAreaUnit, unitConverter); @@ -707,13 +706,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public VolumeFlowPerArea ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -888,15 +887,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(VolumeFlowPerArea)) + if (conversionType == typeof(VolumeFlowPerArea)) return this; - else if(conversionType == typeof(VolumeFlowPerAreaUnit)) + else if (conversionType == typeof(VolumeFlowPerAreaUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return VolumeFlowPerArea.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return VolumeFlowPerArea.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return VolumeFlowPerArea.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(VolumeFlowPerArea)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs index bf534bd699..00b18d05a9 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -85,7 +85,7 @@ static VolumePerLength() /// If value is NaN or Infinity. public VolumePerLength(double value, VolumePerLengthUnit unit) { - if(unit == VolumePerLengthUnit.Undefined) + if (unit == VolumePerLengthUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -102,7 +102,7 @@ public VolumePerLength(double value, VolumePerLengthUnit unit) /// No unit was found for the given . public VolumePerLength(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -246,7 +246,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.LiterPerMeter, quantity => new VolumePerLength(quantity.Value*1000, VolumePerLengthUnit.LiterPerMeter)); unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.LiterPerMillimeter, quantity => new VolumePerLength(quantity.Value, VolumePerLengthUnit.LiterPerMillimeter)); unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.OilBarrelPerFoot, quantity => new VolumePerLength(quantity.Value*1.91713408, VolumePerLengthUnit.OilBarrelPerFoot)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(VolumePerLengthUnit.CubicMeterPerMeter, VolumePerLengthUnit.CubicMeterPerMeter, quantity => quantity); @@ -605,8 +604,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Volum /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumePerLength objVolumePerLength)) throw new ArgumentException("Expected type VolumePerLength.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is VolumePerLength objVolumePerLength)) throw new ArgumentException("Expected type VolumePerLength.", nameof(obj)); return CompareTo(objVolumePerLength); } @@ -621,7 +620,7 @@ public int CompareTo(VolumePerLength other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is VolumePerLength objVolumePerLength)) + if (obj is null || !(obj is VolumePerLength objVolumePerLength)) return false; return Equals(objVolumePerLength); @@ -676,7 +675,7 @@ public bool Equals(VolumePerLength other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(VolumePerLength other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -704,7 +703,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(VolumePerLengthUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -714,13 +713,13 @@ public double As(VolumePerLengthUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -729,7 +728,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is VolumePerLengthUnit unitAsVolumePerLengthUnit)) + if (!(unit is VolumePerLengthUnit unitAsVolumePerLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumePerLengthUnit)} is supported.", nameof(unit)); return As(unitAsVolumePerLengthUnit); @@ -753,18 +752,18 @@ public VolumePerLength ToUnit(VolumePerLengthUnit unit) /// A VolumePerLength with the specified unit. public VolumePerLength ToUnit(VolumePerLengthUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(VolumePerLength), Unit, typeof(VolumePerLength), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(VolumePerLength), Unit, typeof(VolumePerLength), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (VolumePerLength)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -779,7 +778,7 @@ public VolumePerLength ToUnit(VolumePerLengthUnit unit, UnitConverter unitConver /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is VolumePerLengthUnit unitAsVolumePerLengthUnit)) + if (!(unit is VolumePerLengthUnit unitAsVolumePerLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumePerLengthUnit)} is supported.", nameof(unit)); return ToUnit(unitAsVolumePerLengthUnit, DefaultConversionFunctions); @@ -788,7 +787,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is VolumePerLengthUnit unitAsVolumePerLengthUnit)) + if (!(unit is VolumePerLengthUnit unitAsVolumePerLengthUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumePerLengthUnit)} is supported.", nameof(unit)); return ToUnit(unitAsVolumePerLengthUnit, unitConverter); @@ -797,13 +796,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public VolumePerLength ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -978,15 +977,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(VolumePerLength)) + if (conversionType == typeof(VolumePerLength)) return this; - else if(conversionType == typeof(VolumePerLengthUnit)) + else if (conversionType == typeof(VolumePerLengthUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return VolumePerLength.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return VolumePerLength.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return VolumePerLength.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(VolumePerLength)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs index 674c0e5466..fdc64011d4 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs @@ -90,7 +90,7 @@ static VolumetricHeatCapacity() /// If value is NaN or Infinity. public VolumetricHeatCapacity(double value, VolumetricHeatCapacityUnit unit) { - if(unit == VolumetricHeatCapacityUnit.Undefined) + if (unit == VolumetricHeatCapacityUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -107,7 +107,7 @@ public VolumetricHeatCapacity(double value, VolumetricHeatCapacityUnit unit) /// No unit was found for the given . public VolumetricHeatCapacity(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -263,7 +263,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin, VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin, quantity => new VolumetricHeatCapacity((quantity.Value) / 1e3d, VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin)); unitConverter.SetConversionFunction(VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius, quantity => new VolumetricHeatCapacity((quantity.Value) / 1e6d, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius)); unitConverter.SetConversionFunction(VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin, quantity => new VolumetricHeatCapacity((quantity.Value) / 1e6d, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin, quantity => quantity); @@ -644,8 +643,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Volum /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumetricHeatCapacity objVolumetricHeatCapacity)) throw new ArgumentException("Expected type VolumetricHeatCapacity.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is VolumetricHeatCapacity objVolumetricHeatCapacity)) throw new ArgumentException("Expected type VolumetricHeatCapacity.", nameof(obj)); return CompareTo(objVolumetricHeatCapacity); } @@ -660,7 +659,7 @@ public int CompareTo(VolumetricHeatCapacity other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is VolumetricHeatCapacity objVolumetricHeatCapacity)) + if (obj is null || !(obj is VolumetricHeatCapacity objVolumetricHeatCapacity)) return false; return Equals(objVolumetricHeatCapacity); @@ -715,7 +714,7 @@ public bool Equals(VolumetricHeatCapacity other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(VolumetricHeatCapacity other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -743,7 +742,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(VolumetricHeatCapacityUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -753,13 +752,13 @@ public double As(VolumetricHeatCapacityUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -768,7 +767,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is VolumetricHeatCapacityUnit unitAsVolumetricHeatCapacityUnit)) + if (!(unit is VolumetricHeatCapacityUnit unitAsVolumetricHeatCapacityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumetricHeatCapacityUnit)} is supported.", nameof(unit)); return As(unitAsVolumetricHeatCapacityUnit); @@ -792,18 +791,18 @@ public VolumetricHeatCapacity ToUnit(VolumetricHeatCapacityUnit unit) /// A VolumetricHeatCapacity with the specified unit. public VolumetricHeatCapacity ToUnit(VolumetricHeatCapacityUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(VolumetricHeatCapacity), Unit, typeof(VolumetricHeatCapacity), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(VolumetricHeatCapacity), Unit, typeof(VolumetricHeatCapacity), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (VolumetricHeatCapacity)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -818,7 +817,7 @@ public VolumetricHeatCapacity ToUnit(VolumetricHeatCapacityUnit unit, UnitConver /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is VolumetricHeatCapacityUnit unitAsVolumetricHeatCapacityUnit)) + if (!(unit is VolumetricHeatCapacityUnit unitAsVolumetricHeatCapacityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumetricHeatCapacityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsVolumetricHeatCapacityUnit, DefaultConversionFunctions); @@ -827,7 +826,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is VolumetricHeatCapacityUnit unitAsVolumetricHeatCapacityUnit)) + if (!(unit is VolumetricHeatCapacityUnit unitAsVolumetricHeatCapacityUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumetricHeatCapacityUnit)} is supported.", nameof(unit)); return ToUnit(unitAsVolumetricHeatCapacityUnit, unitConverter); @@ -836,13 +835,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public VolumetricHeatCapacity ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -1017,15 +1016,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(VolumetricHeatCapacity)) + if (conversionType == typeof(VolumetricHeatCapacity)) return this; - else if(conversionType == typeof(VolumetricHeatCapacityUnit)) + else if (conversionType == typeof(VolumetricHeatCapacityUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return VolumetricHeatCapacity.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return VolumetricHeatCapacity.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return VolumetricHeatCapacity.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(VolumetricHeatCapacity)} to {conversionType} is not supported."); diff --git a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs index 3685da53de..2ead6f9214 100644 --- a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs @@ -84,7 +84,7 @@ static WarpingMomentOfInertia() /// If value is NaN or Infinity. public WarpingMomentOfInertia(double value, WarpingMomentOfInertiaUnit unit) { - if(unit == WarpingMomentOfInertiaUnit.Undefined) + if (unit == WarpingMomentOfInertiaUnit.Undefined) throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); _value = Guard.EnsureValidNumber(value, nameof(value)); @@ -101,7 +101,7 @@ public WarpingMomentOfInertia(double value, WarpingMomentOfInertiaUnit unit) /// No unit was found for the given . public WarpingMomentOfInertia(double value, UnitSystem unitSystem) { - if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); @@ -239,7 +239,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(WarpingMomentOfInertiaUnit.MeterToTheSixth, WarpingMomentOfInertiaUnit.FootToTheSixth, quantity => new WarpingMomentOfInertia(quantity.Value/Math.Pow(0.3048, 6), WarpingMomentOfInertiaUnit.FootToTheSixth)); unitConverter.SetConversionFunction(WarpingMomentOfInertiaUnit.MeterToTheSixth, WarpingMomentOfInertiaUnit.InchToTheSixth, quantity => new WarpingMomentOfInertia(quantity.Value/Math.Pow(2.54e-2, 6), WarpingMomentOfInertiaUnit.InchToTheSixth)); unitConverter.SetConversionFunction(WarpingMomentOfInertiaUnit.MeterToTheSixth, WarpingMomentOfInertiaUnit.MillimeterToTheSixth, quantity => new WarpingMomentOfInertia(quantity.Value*1e18, WarpingMomentOfInertiaUnit.MillimeterToTheSixth)); - // Register in unit converter: BaseUnit <-> BaseUnit unitConverter.SetConversionFunction(WarpingMomentOfInertiaUnit.MeterToTheSixth, WarpingMomentOfInertiaUnit.MeterToTheSixth, quantity => quantity); @@ -587,8 +586,8 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Warpi /// public int CompareTo(object obj) { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is WarpingMomentOfInertia objWarpingMomentOfInertia)) throw new ArgumentException("Expected type WarpingMomentOfInertia.", nameof(obj)); + if (obj is null) throw new ArgumentNullException(nameof(obj)); + if (!(obj is WarpingMomentOfInertia objWarpingMomentOfInertia)) throw new ArgumentException("Expected type WarpingMomentOfInertia.", nameof(obj)); return CompareTo(objWarpingMomentOfInertia); } @@ -603,7 +602,7 @@ public int CompareTo(WarpingMomentOfInertia other) /// Consider using for safely comparing floating point values. public override bool Equals(object obj) { - if(obj is null || !(obj is WarpingMomentOfInertia objWarpingMomentOfInertia)) + if (obj is null || !(obj is WarpingMomentOfInertia objWarpingMomentOfInertia)) return false; return Equals(objWarpingMomentOfInertia); @@ -658,7 +657,7 @@ public bool Equals(WarpingMomentOfInertia other) /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. public bool Equals(WarpingMomentOfInertia other, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); double thisValue = (double)this.Value; @@ -686,7 +685,7 @@ public override int GetHashCode() /// Value converted to the specified unit. public double As(WarpingMomentOfInertiaUnit unit) { - if(Unit == unit) + if (Unit == unit) return Convert.ToDouble(Value); var converted = GetValueAs(unit); @@ -696,13 +695,13 @@ public double As(WarpingMomentOfInertiaUnit unit) /// public double As(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return As(firstUnitInfo.Value); @@ -711,7 +710,7 @@ public double As(UnitSystem unitSystem) /// double IQuantity.As(Enum unit) { - if(!(unit is WarpingMomentOfInertiaUnit unitAsWarpingMomentOfInertiaUnit)) + if (!(unit is WarpingMomentOfInertiaUnit unitAsWarpingMomentOfInertiaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(WarpingMomentOfInertiaUnit)} is supported.", nameof(unit)); return As(unitAsWarpingMomentOfInertiaUnit); @@ -735,18 +734,18 @@ public WarpingMomentOfInertia ToUnit(WarpingMomentOfInertiaUnit unit) /// A WarpingMomentOfInertia with the specified unit. public WarpingMomentOfInertia ToUnit(WarpingMomentOfInertiaUnit unit, UnitConverter unitConverter) { - if(Unit == unit) + if (Unit == unit) { // Already in requested units. return this; } - else if(unitConverter.TryGetConversionFunction((typeof(WarpingMomentOfInertia), Unit, typeof(WarpingMomentOfInertia), unit), out var conversionFunction)) + else if (unitConverter.TryGetConversionFunction((typeof(WarpingMomentOfInertia), Unit, typeof(WarpingMomentOfInertia), unit), out var conversionFunction)) { // Direct conversion to requested unit found. Return the converted quantity. var converted = conversionFunction(this); return (WarpingMomentOfInertia)converted; } - else if(Unit != BaseUnit) + else if (Unit != BaseUnit) { // Direct conversion to requested unit NOT found. Convert to BaseUnit, and then from BaseUnit to requested unit. var inBaseUnits = ToUnit(BaseUnit); @@ -761,7 +760,7 @@ public WarpingMomentOfInertia ToUnit(WarpingMomentOfInertiaUnit unit, UnitConver /// IQuantity IQuantity.ToUnit(Enum unit) { - if(!(unit is WarpingMomentOfInertiaUnit unitAsWarpingMomentOfInertiaUnit)) + if (!(unit is WarpingMomentOfInertiaUnit unitAsWarpingMomentOfInertiaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(WarpingMomentOfInertiaUnit)} is supported.", nameof(unit)); return ToUnit(unitAsWarpingMomentOfInertiaUnit, DefaultConversionFunctions); @@ -770,7 +769,7 @@ IQuantity IQuantity.ToUnit(Enum unit) /// IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) { - if(!(unit is WarpingMomentOfInertiaUnit unitAsWarpingMomentOfInertiaUnit)) + if (!(unit is WarpingMomentOfInertiaUnit unitAsWarpingMomentOfInertiaUnit)) throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(WarpingMomentOfInertiaUnit)} is supported.", nameof(unit)); return ToUnit(unitAsWarpingMomentOfInertiaUnit, unitConverter); @@ -779,13 +778,13 @@ IQuantity IQuantity.ToUnit(Enum unit, UnitConverter unitConverter) /// public WarpingMomentOfInertia ToUnit(UnitSystem unitSystem) { - if(unitSystem is null) + if (unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); var firstUnitInfo = unitInfos.FirstOrDefault(); - if(firstUnitInfo == null) + if (firstUnitInfo == null) throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); return ToUnit(firstUnitInfo.Value); @@ -960,15 +959,15 @@ string IConvertible.ToString(IFormatProvider provider) object IConvertible.ToType(Type conversionType, IFormatProvider provider) { - if(conversionType == typeof(WarpingMomentOfInertia)) + if (conversionType == typeof(WarpingMomentOfInertia)) return this; - else if(conversionType == typeof(WarpingMomentOfInertiaUnit)) + else if (conversionType == typeof(WarpingMomentOfInertiaUnit)) return Unit; - else if(conversionType == typeof(QuantityType)) + else if (conversionType == typeof(QuantityType)) return WarpingMomentOfInertia.QuantityType; - else if(conversionType == typeof(QuantityInfo)) + else if (conversionType == typeof(QuantityInfo)) return WarpingMomentOfInertia.Info; - else if(conversionType == typeof(BaseDimensions)) + else if (conversionType == typeof(BaseDimensions)) return WarpingMomentOfInertia.BaseDimensions; else throw new InvalidCastException($"Converting {typeof(WarpingMomentOfInertia)} to {conversionType} is not supported."); diff --git a/UnitsNet/QuantityFormatter.cs b/UnitsNet/QuantityFormatter.cs index 87de29d1fa..56e8939d4e 100644 --- a/UnitsNet/QuantityFormatter.cs +++ b/UnitsNet/QuantityFormatter.cs @@ -133,12 +133,12 @@ private static string FormatUntrimmed(IQuantity quantity, { formatProvider ??= CultureInfo.CurrentUICulture; - if(string.IsNullOrWhiteSpace(format)) + if (string.IsNullOrWhiteSpace(format)) format = "g"; char formatSpecifier = format[0]; - if(UnitsNetFormatSpecifiers.Any(unitsNetFormatSpecifier => unitsNetFormatSpecifier == formatSpecifier)) + if (UnitsNetFormatSpecifiers.Any(unitsNetFormatSpecifier => unitsNetFormatSpecifier == formatSpecifier)) { // UnitsNet custom format string @@ -150,7 +150,7 @@ private static string FormatUntrimmed(IQuantity quantity, case 'a': case 'S': case 's': - if(format.Length > 1 && !int.TryParse(format.Substring(1), out precisionSpecifier)) + if (format.Length > 1 && !int.TryParse(format.Substring(1), out precisionSpecifier)) throw new FormatException($"The {format} format string is not supported."); break; } @@ -164,7 +164,7 @@ private static string FormatUntrimmed(IQuantity quantity, case 'a': var abbreviations = UnitAbbreviationsCache.Default.GetUnitAbbreviations(quantity.Unit, formatProvider); - if(precisionSpecifier >= abbreviations.Length) + if (precisionSpecifier >= abbreviations.Length) throw new FormatException($"The {format} format string is invalid because the abbreviation index does not exist."); return abbreviations[precisionSpecifier]; diff --git a/UnitsNet/QuantityInfo.cs b/UnitsNet/QuantityInfo.cs index 2e3471b01e..f2548474ab 100644 --- a/UnitsNet/QuantityInfo.cs +++ b/UnitsNet/QuantityInfo.cs @@ -61,7 +61,7 @@ public QuantityInfo(QuantityType quantityType, [NotNull] UnitInfo[] unitInfos, [ public QuantityInfo([NotNull] string name, Type unitType, [NotNull] UnitInfo[] unitInfos, [NotNull] Enum baseUnit, [NotNull] IQuantity zero, [NotNull] BaseDimensions baseDimensions, QuantityType quantityType = QuantityType.Undefined) { - if(baseUnit == null) throw new ArgumentNullException(nameof(baseUnit)); + if (baseUnit == null) throw new ArgumentNullException(nameof(baseUnit)); BaseDimensions = baseDimensions ?? throw new ArgumentNullException(nameof(baseDimensions)); Zero = zero ?? throw new ArgumentNullException(nameof(zero)); @@ -150,7 +150,7 @@ public QuantityInfo([NotNull] string name, Type unitType, [NotNull] UnitInfo[] u /// More than one unit was found that is a subset of . public UnitInfo GetUnitInfoFor(BaseUnits baseUnits) { - if(baseUnits is null) + if (baseUnits is null) throw new ArgumentNullException(nameof(baseUnits)); var matchingUnitInfos = GetUnitInfosFor(baseUnits) @@ -175,7 +175,7 @@ public UnitInfo GetUnitInfoFor(BaseUnits baseUnits) /// is null. public IEnumerable GetUnitInfosFor(BaseUnits baseUnits) { - if(baseUnits is null) + if (baseUnits is null) throw new ArgumentNullException(nameof(baseUnits)); return UnitInfos.Where((unitInfo) => unitInfo.BaseUnits.IsSubsetOf(baseUnits)); diff --git a/UnitsNet/QuantityTypeConverter.cs b/UnitsNet/QuantityTypeConverter.cs index dbbe2865ae..9da1c07fdc 100644 --- a/UnitsNet/QuantityTypeConverter.cs +++ b/UnitsNet/QuantityTypeConverter.cs @@ -176,7 +176,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c if (double.TryParse(stringValue, NumberStyles.Any, culture, out double dvalue)) { var defaultUnit = GetAttribute(context) ?? new DefaultUnitAttribute(default(TQuantity).Unit); - if(defaultUnit.UnitType != null) + if (defaultUnit.UnitType != null) quantity = Quantity.From(dvalue, defaultUnit.UnitType); } else @@ -184,7 +184,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c quantity = Quantity.Parse(culture, typeof(TQuantity), stringValue); } - if( quantity != null ) + if (quantity != null) { ConvertToUnitAttribute? convertToUnit = GetAttribute(context); if (convertToUnit != null && convertToUnit.UnitType != null) diff --git a/UnitsNet/UnitConverter.cs b/UnitsNet/UnitConverter.cs index 775f91f0ff..a8aceef5ff 100644 --- a/UnitsNet/UnitConverter.cs +++ b/UnitsNet/UnitConverter.cs @@ -77,7 +77,7 @@ private ConcurrentDictionary Co /// The to register the default conversion functions in. public static void RegisterDefaultConversions(UnitConverter unitConverter) { - if(unitConverter is null) + if (unitConverter is null) throw new ArgumentNullException(nameof(unitConverter)); foreach(var quantity in Quantity.GetQuantityTypes())