From 2373c261c9323cf38d499c7d9fef2a9c28bdb9f8 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 1 Feb 2019 10:28:49 -0500 Subject: [PATCH 1/3] Implementing IConvertible --- UnitsNet.Tests/QuantityIConvertibleTests.cs | 172 ++++++++++++++++++ .../Acceleration.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...ntOfSubstance.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...mplitudeRatio.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Angle.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...pparentEnergy.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...ApparentPower.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Area.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../AreaDensity.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...mentOfInertia.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../BitRate.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...elConsumption.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Capacitance.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...rmalExpansion.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Density.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Duration.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...amicViscosity.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...ricAdmittance.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...lectricCharge.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...ChargeDensity.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...icConductance.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...cConductivity.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...ectricCurrent.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...urrentDensity.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...rrentGradient.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...ElectricField.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...ricInductance.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...tricPotential.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...icPotentialAc.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...icPotentialDc.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...ricResistance.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...icResistivity.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Energy.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Entropy.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Force.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...rceChangeRate.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...orcePerLength.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Frequency.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../HeatFlux.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...erCoefficient.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Illuminance.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Information.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Irradiance.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Irradiation.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...aticViscosity.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../LapseRate.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Length.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Level.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...LinearDensity.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../LuminousFlux.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...nousIntensity.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...MagneticField.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../MagneticFlux.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...Magnetization.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Mass.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../MassFlow.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../MassFlux.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...mentOfInertia.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../MolarEnergy.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../MolarEntropy.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../MolarMass.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Molarity.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Permeability.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Permittivity.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Power.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../PowerDensity.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../PowerRatio.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Pressure.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...ureChangeRate.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Ratio.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...eactiveEnergy.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...ReactivePower.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...lAcceleration.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...tationalSpeed.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...onalStiffness.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...nessPerLength.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../SolidAngle.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...pecificEnergy.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...ecificEntropy.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...pecificVolume.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...pecificWeight.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Speed.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Temperature.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...ureChangeRate.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...peratureDelta.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...lConductivity.WindowsRuntimeComponent.g.cs | 98 ++++++++++ ...malResistance.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Torque.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../VitaminA.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Volume.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../VolumeFlow.WindowsRuntimeComponent.g.cs | 98 ++++++++++ .../Quantities/Acceleration.NetFramework.g.cs | 99 +++++++++- .../AmountOfSubstance.NetFramework.g.cs | 99 +++++++++- .../AmplitudeRatio.NetFramework.g.cs | 99 +++++++++- .../Quantities/Angle.NetFramework.g.cs | 99 +++++++++- .../ApparentEnergy.NetFramework.g.cs | 99 +++++++++- .../ApparentPower.NetFramework.g.cs | 99 +++++++++- .../Quantities/Area.NetFramework.g.cs | 99 +++++++++- .../Quantities/AreaDensity.NetFramework.g.cs | 99 +++++++++- .../AreaMomentOfInertia.NetFramework.g.cs | 99 +++++++++- .../Quantities/BitRate.NetFramework.g.cs | 99 +++++++++- ...eSpecificFuelConsumption.NetFramework.g.cs | 99 +++++++++- .../Quantities/Capacitance.NetFramework.g.cs | 99 +++++++++- ...icientOfThermalExpansion.NetFramework.g.cs | 99 +++++++++- .../Quantities/Density.NetFramework.g.cs | 99 +++++++++- .../Quantities/Duration.NetFramework.g.cs | 99 +++++++++- .../DynamicViscosity.NetFramework.g.cs | 99 +++++++++- .../ElectricAdmittance.NetFramework.g.cs | 99 +++++++++- .../ElectricCharge.NetFramework.g.cs | 99 +++++++++- .../ElectricChargeDensity.NetFramework.g.cs | 99 +++++++++- .../ElectricConductance.NetFramework.g.cs | 99 +++++++++- .../ElectricConductivity.NetFramework.g.cs | 99 +++++++++- .../ElectricCurrent.NetFramework.g.cs | 99 +++++++++- .../ElectricCurrentDensity.NetFramework.g.cs | 99 +++++++++- .../ElectricCurrentGradient.NetFramework.g.cs | 99 +++++++++- .../ElectricField.NetFramework.g.cs | 99 +++++++++- .../ElectricInductance.NetFramework.g.cs | 99 +++++++++- .../ElectricPotential.NetFramework.g.cs | 99 +++++++++- .../ElectricPotentialAc.NetFramework.g.cs | 99 +++++++++- .../ElectricPotentialDc.NetFramework.g.cs | 99 +++++++++- .../ElectricResistance.NetFramework.g.cs | 99 +++++++++- .../ElectricResistivity.NetFramework.g.cs | 99 +++++++++- .../Quantities/Energy.NetFramework.g.cs | 99 +++++++++- .../Quantities/Entropy.NetFramework.g.cs | 99 +++++++++- .../Quantities/Force.NetFramework.g.cs | 99 +++++++++- .../ForceChangeRate.NetFramework.g.cs | 99 +++++++++- .../ForcePerLength.NetFramework.g.cs | 99 +++++++++- .../Quantities/Frequency.NetFramework.g.cs | 99 +++++++++- .../Quantities/HeatFlux.NetFramework.g.cs | 99 +++++++++- .../HeatTransferCoefficient.NetFramework.g.cs | 99 +++++++++- .../Quantities/Illuminance.NetFramework.g.cs | 99 +++++++++- .../Quantities/Information.NetFramework.g.cs | 99 +++++++++- .../Quantities/Irradiance.NetFramework.g.cs | 99 +++++++++- .../Quantities/Irradiation.NetFramework.g.cs | 99 +++++++++- .../KinematicViscosity.NetFramework.g.cs | 99 +++++++++- .../Quantities/LapseRate.NetFramework.g.cs | 99 +++++++++- .../Quantities/Length.NetFramework.g.cs | 99 +++++++++- .../Quantities/Level.NetFramework.g.cs | 99 +++++++++- .../LinearDensity.NetFramework.g.cs | 99 +++++++++- .../Quantities/LuminousFlux.NetFramework.g.cs | 99 +++++++++- .../LuminousIntensity.NetFramework.g.cs | 99 +++++++++- .../MagneticField.NetFramework.g.cs | 99 +++++++++- .../Quantities/MagneticFlux.NetFramework.g.cs | 99 +++++++++- .../Magnetization.NetFramework.g.cs | 99 +++++++++- .../Quantities/Mass.NetFramework.g.cs | 99 +++++++++- .../Quantities/MassFlow.NetFramework.g.cs | 99 +++++++++- .../Quantities/MassFlux.NetFramework.g.cs | 99 +++++++++- .../MassMomentOfInertia.NetFramework.g.cs | 99 +++++++++- .../Quantities/MolarEnergy.NetFramework.g.cs | 99 +++++++++- .../Quantities/MolarEntropy.NetFramework.g.cs | 99 +++++++++- .../Quantities/MolarMass.NetFramework.g.cs | 99 +++++++++- .../Quantities/Molarity.NetFramework.g.cs | 99 +++++++++- .../Quantities/Permeability.NetFramework.g.cs | 99 +++++++++- .../Quantities/Permittivity.NetFramework.g.cs | 99 +++++++++- .../Quantities/Power.NetFramework.g.cs | 99 +++++++++- .../Quantities/PowerDensity.NetFramework.g.cs | 99 +++++++++- .../Quantities/PowerRatio.NetFramework.g.cs | 99 +++++++++- .../Quantities/Pressure.NetFramework.g.cs | 99 +++++++++- .../PressureChangeRate.NetFramework.g.cs | 99 +++++++++- .../Quantities/Ratio.NetFramework.g.cs | 99 +++++++++- .../ReactiveEnergy.NetFramework.g.cs | 99 +++++++++- .../ReactivePower.NetFramework.g.cs | 99 +++++++++- .../RotationalAcceleration.NetFramework.g.cs | 99 +++++++++- .../RotationalSpeed.NetFramework.g.cs | 99 +++++++++- .../RotationalStiffness.NetFramework.g.cs | 99 +++++++++- ...tionalStiffnessPerLength.NetFramework.g.cs | 99 +++++++++- .../Quantities/SolidAngle.NetFramework.g.cs | 99 +++++++++- .../SpecificEnergy.NetFramework.g.cs | 99 +++++++++- .../SpecificEntropy.NetFramework.g.cs | 99 +++++++++- .../SpecificVolume.NetFramework.g.cs | 99 +++++++++- .../SpecificWeight.NetFramework.g.cs | 99 +++++++++- .../Quantities/Speed.NetFramework.g.cs | 99 +++++++++- .../Quantities/Temperature.NetFramework.g.cs | 99 +++++++++- .../TemperatureChangeRate.NetFramework.g.cs | 99 +++++++++- .../TemperatureDelta.NetFramework.g.cs | 99 +++++++++- .../ThermalConductivity.NetFramework.g.cs | 99 +++++++++- .../ThermalResistance.NetFramework.g.cs | 99 +++++++++- .../Quantities/Torque.NetFramework.g.cs | 99 +++++++++- .../Quantities/VitaminA.NetFramework.g.cs | 99 +++++++++- .../Quantities/Volume.NetFramework.g.cs | 99 +++++++++- .../Quantities/VolumeFlow.NetFramework.g.cs | 99 +++++++++- ...GenerateQuantitySourceCodeNetFramework.ps1 | 101 +++++++++- 182 files changed, 17911 insertions(+), 92 deletions(-) create mode 100644 UnitsNet.Tests/QuantityIConvertibleTests.cs diff --git a/UnitsNet.Tests/QuantityIConvertibleTests.cs b/UnitsNet.Tests/QuantityIConvertibleTests.cs new file mode 100644 index 0000000000..24a6326c5a --- /dev/null +++ b/UnitsNet.Tests/QuantityIConvertibleTests.cs @@ -0,0 +1,172 @@ +using System; +using UnitsNet.Units; +using Xunit; + +namespace UnitsNet.Tests +{ + public class QuantityIConvertibleTests + { + private static Length length = Length.FromMeters(3.0); + private static IConvertible lengthAsIConvertible = Length.FromMeters(3.0); + + [Fact] + public void GetTypeCodeTest() + { + Assert.Equal(TypeCode.Object, lengthAsIConvertible.GetTypeCode()); + Assert.Equal(TypeCode.Object, Convert.GetTypeCode(length)); + } + + [Fact] + public void ToBooleanTest() + { + Assert.Throws(() => lengthAsIConvertible.ToBoolean(null)); + Assert.Throws(() => Convert.ToBoolean(length)); + Assert.Throws(() => Convert.ChangeType(length, typeof(bool))); + } + + [Fact] + public void ToByteTest() + { + byte expected = 3; + Assert.Equal(expected, lengthAsIConvertible.ToByte(null)); + Assert.Equal(expected, Convert.ToByte(length)); + Assert.Equal(expected, Convert.ChangeType(length, typeof(byte))); + } + + [Fact] + public void ToCharTest() + { + Assert.Throws(() => lengthAsIConvertible.ToChar(null)); + Assert.Throws(() => Convert.ToChar(length)); + Assert.Throws(() => Convert.ChangeType(length, typeof(char))); + } + + [Fact] + public void ToDateTimeTest() + { + Assert.Throws(() => lengthAsIConvertible.ToDateTime(null)); + Assert.Throws(() => Convert.ToDateTime(length)); + Assert.Throws(() => Convert.ChangeType(length, typeof(DateTime))); + } + + [Fact] + public void ToDecimalTest() + { + decimal expected = 3; + Assert.Equal(expected, lengthAsIConvertible.ToDecimal(null)); + Assert.Equal(expected, Convert.ToDecimal(length)); + Assert.Equal(expected, Convert.ChangeType(length, typeof(decimal))); + } + + [Fact] + public void ToDoubleTest() + { + double expected = 3.0; + Assert.Equal(expected, lengthAsIConvertible.ToDouble(null)); + Assert.Equal(expected, Convert.ToDouble(length)); + Assert.Equal(expected, Convert.ChangeType(length, typeof(double))); + } + + [Fact] + public void ToInt16Test() + { + short expected = 3; + Assert.Equal(expected, lengthAsIConvertible.ToInt16(null)); + Assert.Equal(expected, Convert.ToInt16(length)); + Assert.Equal(expected, Convert.ChangeType(length, typeof(short))); + } + + [Fact] + public void ToInt32Test() + { + int expected = 3; + Assert.Equal(expected, lengthAsIConvertible.ToInt32(null)); + Assert.Equal(expected, Convert.ToInt32(length)); + Assert.Equal(expected, Convert.ChangeType(length, typeof(int))); + } + + [Fact] + public void ToInt64Test() + { + long expected = 3; + Assert.Equal(expected, lengthAsIConvertible.ToInt64(null)); + Assert.Equal(expected, Convert.ToInt64(length)); + Assert.Equal(expected, Convert.ChangeType(length, typeof(long))); + } + + [Fact] + public void ToSByteTest() + { + sbyte expected = 3; + Assert.Equal(expected, lengthAsIConvertible.ToSByte(null)); + Assert.Equal(expected, Convert.ToSByte(length)); + Assert.Equal(expected, Convert.ChangeType(length, typeof(sbyte))); + } + + [Fact] + public void ToSingleTest() + { + float expected = 3; + Assert.Equal(expected, lengthAsIConvertible.ToSingle(null)); + Assert.Equal(expected, Convert.ToSingle(length)); + Assert.Equal(expected, Convert.ChangeType(length, typeof(float))); + } + + [Fact] + public void ToStringTest() + { + string expected = length.ToString(GlobalConfiguration.DefaultCulture); + Assert.Equal(expected, lengthAsIConvertible.ToString(GlobalConfiguration.DefaultCulture)); + Assert.Equal(expected, Convert.ToString(length, GlobalConfiguration.DefaultCulture)); + Assert.Equal(expected, Convert.ChangeType(length, typeof(string), GlobalConfiguration.DefaultCulture)); + } + + [Fact] + public void ToTypeTest() + { + // Same quantity type + Assert.Equal(length, lengthAsIConvertible.ToType(typeof(Length), null)); + Assert.Equal(length, Convert.ChangeType(length, typeof(Length))); + + // Same unit type + Assert.Equal(length.Unit, lengthAsIConvertible.ToType(typeof(LengthUnit), null)); + Assert.Equal(length.Unit, Convert.ChangeType(length, typeof(LengthUnit))); + + // Different type + Assert.Throws(() => lengthAsIConvertible.ToType(typeof(Duration), null)); + Assert.Throws(() => Convert.ChangeType(length, typeof(Duration))); + + + // Different unit type + Assert.Throws(() => lengthAsIConvertible.ToType(typeof(DurationUnit), null)); + Assert.Throws(() => Convert.ChangeType(length, typeof(DurationUnit))); + } + + [Fact] + public void ToUInt16Test() + { + ushort expected = 3; + Assert.Equal(expected, lengthAsIConvertible.ToUInt16(null)); + Assert.Equal(expected, Convert.ToUInt16(length)); + Assert.Equal(expected, Convert.ChangeType(length, typeof(ushort))); + } + + [Fact] + public void ToUInt32Test() + { + uint expected = 3; + Assert.Equal(expected, lengthAsIConvertible.ToUInt32(null)); + Assert.Equal(expected, Convert.ToUInt32(length)); + Assert.Equal(expected, Convert.ChangeType(length, typeof(uint))); + } + + [Fact] + public void ToUInt64Test() + { + ulong expected = 3; + Assert.Equal(expected, lengthAsIConvertible.ToUInt64(null)); + Assert.Equal(expected, Convert.ToUInt64(length)); + Assert.Equal(expected, Convert.ChangeType(length, typeof(ulong))); + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs index 94443bd88f..7492686b68 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs @@ -784,5 +784,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Acceleration)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Acceleration)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Acceleration)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Acceleration)) + return this; + else if(conversionType == typeof(AccelerationUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Acceleration)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs index d12377f8cd..abca1b2906 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs @@ -818,5 +818,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(AmountOfSubstance)) + return this; + else if(conversionType == typeof(AmountOfSubstanceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs index d21e5fc694..07a9861d4c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs @@ -631,5 +631,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(AmplitudeRatio)) + return this; + else if(conversionType == typeof(AmplitudeRatioUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs index 3d9cf1e03d..df4702c3dd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs @@ -801,5 +801,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Angle)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Angle)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Angle)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Angle)) + return this; + else if(conversionType == typeof(AngleUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Angle)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs index 4cc4e3372b..196e0dd21a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs @@ -614,5 +614,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ApparentEnergy)) + return this; + else if(conversionType == typeof(ApparentEnergyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs index 688c067c0b..9986eef74b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs @@ -631,5 +631,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ApparentPower)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ApparentPower)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ApparentPower)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ApparentPower)) + return this; + else if(conversionType == typeof(ApparentPowerUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ApparentPower)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs index fcbc55be4a..6560a2b0e8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs @@ -784,5 +784,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Area)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Area)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Area)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Area)) + return this; + else if(conversionType == typeof(AreaUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Area)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs index 3c0ed1599b..8c5e37a6a9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs @@ -580,5 +580,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AreaDensity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AreaDensity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AreaDensity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(AreaDensity)) + return this; + else if(conversionType == typeof(AreaDensityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(AreaDensity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs index 80f4284676..5ffb936380 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -665,5 +665,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(AreaMomentOfInertia)) + return this; + else if(conversionType == typeof(AreaMomentOfInertiaUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs index 2c1d25a564..c5ef616220 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs @@ -1008,5 +1008,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(BitRate)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(BitRate)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(BitRate)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(BitRate)) + return this; + else if(conversionType == typeof(BitRateUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(BitRate)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs index 131983f29c..a763c7ed1d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs @@ -614,5 +614,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(BrakeSpecificFuelConsumption)) + return this; + else if(conversionType == typeof(BrakeSpecificFuelConsumptionUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs index 5a8f365de0..78f12393ab 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs @@ -685,5 +685,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Capacitance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Capacitance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Capacitance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Capacitance)) + return this; + else if(conversionType == typeof(CapacitanceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Capacitance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs index 4902ecaf69..0df7ef9ac2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs @@ -614,5 +614,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(CoefficientOfThermalExpansion)) + return this; + else if(conversionType == typeof(CoefficientOfThermalExpansionUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs index 2c40ddcdb0..cea7e4ba28 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs @@ -1229,5 +1229,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Density)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Density)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Density)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Density)) + return this; + else if(conversionType == typeof(DensityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Density)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs index 8efdc33abc..256b60cbf9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs @@ -733,5 +733,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Duration)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Duration)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Duration)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Duration)) + return this; + else if(conversionType == typeof(DurationUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Duration)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs index 10692d435a..d9ebcd5b1a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs @@ -668,5 +668,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(DynamicViscosity)) + return this; + else if(conversionType == typeof(DynamicViscosityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs index f76c280ffe..432f9a6b47 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs @@ -631,5 +631,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricAdmittance)) + return this; + else if(conversionType == typeof(ElectricAdmittanceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs index 0b97812a5e..4b8e88c42f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs @@ -583,5 +583,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricCharge)) + return this; + else if(conversionType == typeof(ElectricChargeUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs index a72d719df7..06f51d75fd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs @@ -583,5 +583,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricChargeDensity)) + return this; + else if(conversionType == typeof(ElectricChargeDensityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs index 9b2353aa76..1d58ee9ad7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs @@ -617,5 +617,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricConductance)) + return this; + else if(conversionType == typeof(ElectricConductanceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs index d463e98045..52ed2e0dc7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs @@ -583,5 +583,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricConductivity)) + return this; + else if(conversionType == typeof(ElectricConductivityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs index 03021b033b..3e836df925 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs @@ -699,5 +699,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricCurrent)) + return this; + else if(conversionType == typeof(ElectricCurrentUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs index 947625b277..5df901a009 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs @@ -583,5 +583,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricCurrentDensity)) + return this; + else if(conversionType == typeof(ElectricCurrentDensityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs index 5bf58fa07e..4d14557f2c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs @@ -580,5 +580,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricCurrentGradient)) + return this; + else if(conversionType == typeof(ElectricCurrentGradientUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs index db0428419f..c821709565 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs @@ -583,5 +583,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricField)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricField)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricField)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricField)) + return this; + else if(conversionType == typeof(ElectricFieldUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricField)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs index ad3717ead6..ab7e7ad0d4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs @@ -634,5 +634,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricInductance)) + return this; + else if(conversionType == typeof(ElectricInductanceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs index 438a68a7fe..6a2f3bf719 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs @@ -648,5 +648,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricPotential)) + return this; + else if(conversionType == typeof(ElectricPotentialUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs index 8c934c4ea6..9a0eb5257b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs @@ -648,5 +648,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricPotentialAc)) + return this; + else if(conversionType == typeof(ElectricPotentialAcUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs index 4752150d04..1fb8a2b693 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs @@ -648,5 +648,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricPotentialDc)) + return this; + else if(conversionType == typeof(ElectricPotentialDcUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs index f9734c9e9b..db63ffc2d3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs @@ -648,5 +648,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricResistance)) + return this; + else if(conversionType == typeof(ElectricResistanceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs index da7f2187cb..3c67e2a80a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs @@ -804,5 +804,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricResistivity)) + return this; + else if(conversionType == typeof(ElectricResistivityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs index 17cf032399..e6318d881e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs @@ -937,5 +937,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Energy)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Energy)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Energy)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Energy)) + return this; + else if(conversionType == typeof(EnergyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Energy)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs index ef0f26a47a..6384982d18 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs @@ -682,5 +682,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Entropy)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Entropy)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Entropy)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Entropy)) + return this; + else if(conversionType == typeof(EntropyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Entropy)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs index 389158cd90..c60a539278 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs @@ -784,5 +784,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Force)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Force)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Force)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Force)) + return this; + else if(conversionType == typeof(ForceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Force)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs index 6ae9f79fc4..c44992c404 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs @@ -750,5 +750,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ForceChangeRate)) + return this; + else if(conversionType == typeof(ForceChangeRateUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs index cb16d22827..be04373380 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs @@ -716,5 +716,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ForcePerLength)) + return this; + else if(conversionType == typeof(ForcePerLengthUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs index a7378ba6cc..20e871a7c7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs @@ -699,5 +699,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Frequency)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Frequency)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Frequency)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Frequency)) + return this; + else if(conversionType == typeof(FrequencyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Frequency)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs index 69a30764ff..b94fe339ad 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs @@ -869,5 +869,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(HeatFlux)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(HeatFlux)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(HeatFlux)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(HeatFlux)) + return this; + else if(conversionType == typeof(HeatFluxUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(HeatFlux)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs index d939b00b16..480ba7bc2e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs @@ -597,5 +597,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(HeatTransferCoefficient)) + return this; + else if(conversionType == typeof(HeatTransferCoefficientUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs index db8d457c27..1380fda70d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs @@ -634,5 +634,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Illuminance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Illuminance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Illuminance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Illuminance)) + return this; + else if(conversionType == typeof(IlluminanceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Illuminance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs index 22455abe25..c54c532613 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs @@ -1005,5 +1005,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Information)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Information)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Information)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Information)) + return this; + else if(conversionType == typeof(InformationUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Information)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs index e8bc9ba2cb..c8a59edc2f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs @@ -801,5 +801,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Irradiance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Irradiance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Irradiance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Irradiance)) + return this; + else if(conversionType == typeof(IrradianceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Irradiance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs index ac31b948fa..aa77d64a18 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs @@ -634,5 +634,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Irradiation)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Irradiation)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Irradiation)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Irradiation)) + return this; + else if(conversionType == typeof(IrradiationUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Irradiation)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs index 850806d6d3..859f2a094c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs @@ -702,5 +702,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(KinematicViscosity)) + return this; + else if(conversionType == typeof(KinematicViscosityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs index c06e9e8ff7..d00feb833f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs @@ -580,5 +580,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LapseRate)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LapseRate)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LapseRate)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(LapseRate)) + return this; + else if(conversionType == typeof(LapseRateUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(LapseRate)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs index 27c0b1b62e..5c3dfa87c2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs @@ -937,5 +937,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Length)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Length)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Length)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Length)) + return this; + else if(conversionType == typeof(LengthUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Length)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs index 15753301fa..abf428750a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs @@ -597,5 +597,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Level)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Level)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Level)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Level)) + return this; + else if(conversionType == typeof(LevelUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Level)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs index d363005ee2..1b2ace3df8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs @@ -617,5 +617,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LinearDensity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LinearDensity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LinearDensity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(LinearDensity)) + return this; + else if(conversionType == typeof(LinearDensityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(LinearDensity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs index 7ccd8f8ef4..53ba7188cd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs @@ -583,5 +583,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(LuminousFlux)) + return this; + else if(conversionType == typeof(LuminousFluxUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs index 0852f82a46..e74aaafea4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs @@ -583,5 +583,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(LuminousIntensity)) + return this; + else if(conversionType == typeof(LuminousIntensityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs index aa2a621aa7..ae6cb6a83a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs @@ -634,5 +634,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MagneticField)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MagneticField)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MagneticField)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(MagneticField)) + return this; + else if(conversionType == typeof(MagneticFieldUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(MagneticField)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs index 4d9a704788..99b801ac2d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs @@ -583,5 +583,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(MagneticFlux)) + return this; + else if(conversionType == typeof(MagneticFluxUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs index 4291d2a12e..0a9534fb3e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs @@ -583,5 +583,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Magnetization)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Magnetization)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Magnetization)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Magnetization)) + return this; + else if(conversionType == typeof(MagnetizationUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Magnetization)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs index fba18671c9..795bec08c6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs @@ -954,5 +954,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Mass)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Mass)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Mass)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Mass)) + return this; + else if(conversionType == typeof(MassUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Mass)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs index 69e0f0b145..50e8c2c886 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs @@ -1090,5 +1090,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassFlow)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassFlow)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassFlow)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(MassFlow)) + return this; + else if(conversionType == typeof(MassFlowUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(MassFlow)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs index 33d9390752..c75fa82568 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs @@ -597,5 +597,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassFlux)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassFlux)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassFlux)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(MassFlux)) + return this; + else if(conversionType == typeof(MassFluxUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(MassFlux)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs index 893be9d39d..2f5e8322f3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -1039,5 +1039,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(MassMomentOfInertia)) + return this; + else if(conversionType == typeof(MassMomentOfInertiaUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs index b67a6bb2eb..37bdff50ef 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs @@ -614,5 +614,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(MolarEnergy)) + return this; + else if(conversionType == typeof(MolarEnergyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs index 147d033aae..2042b3cfa5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs @@ -614,5 +614,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(MolarEntropy)) + return this; + else if(conversionType == typeof(MolarEntropyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs index 90b42e3281..cb143da476 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs @@ -767,5 +767,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarMass)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarMass)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarMass)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(MolarMass)) + return this; + else if(conversionType == typeof(MolarMassUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(MolarMass)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs index b7be810adf..c02b7e5b64 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs @@ -702,5 +702,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Molarity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Molarity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Molarity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Molarity)) + return this; + else if(conversionType == typeof(MolarityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Molarity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs index 512fe996d8..cbb0f13a9e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs @@ -583,5 +583,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Permeability)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Permeability)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Permeability)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Permeability)) + return this; + else if(conversionType == typeof(PermeabilityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Permeability)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs index 19ee1e46b7..7869742145 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs @@ -583,5 +583,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Permittivity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Permittivity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Permittivity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Permittivity)) + return this; + else if(conversionType == typeof(PermittivityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Permittivity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs index 53d06b9af2..276dd3cbbd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs @@ -903,5 +903,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Power)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Power)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Power)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Power)) + return this; + else if(conversionType == typeof(PowerUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Power)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs index 49230b2271..b61c15c8f7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs @@ -1311,5 +1311,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PowerDensity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PowerDensity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PowerDensity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(PowerDensity)) + return this; + else if(conversionType == typeof(PowerDensityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(PowerDensity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs index 379026875a..9726ec845f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs @@ -597,5 +597,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PowerRatio)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PowerRatio)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PowerRatio)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(PowerRatio)) + return this; + else if(conversionType == typeof(PowerRatioUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(PowerRatio)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs index f22554a681..14cb98381a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs @@ -1277,5 +1277,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Pressure)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Pressure)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Pressure)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Pressure)) + return this; + else if(conversionType == typeof(PressureUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Pressure)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs index 945ea331e7..f1ca83e8fd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs @@ -682,5 +682,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(PressureChangeRate)) + return this; + else if(conversionType == typeof(PressureChangeRateUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs index 851524fe9d..83fec84776 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs @@ -665,5 +665,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Ratio)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Ratio)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Ratio)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Ratio)) + return this; + else if(conversionType == typeof(RatioUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Ratio)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs index 69d606ef62..7b46adfee2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs @@ -614,5 +614,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ReactiveEnergy)) + return this; + else if(conversionType == typeof(ReactiveEnergyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs index ae479bc556..d07cf83aef 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs @@ -631,5 +631,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ReactivePower)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ReactivePower)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ReactivePower)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ReactivePower)) + return this; + else if(conversionType == typeof(ReactivePowerUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ReactivePower)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs index c8b80cb06d..635d682e37 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs @@ -614,5 +614,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(RotationalAcceleration)) + return this; + else if(conversionType == typeof(RotationalAccelerationUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs index 7dfdd3637c..c1a06101c8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs @@ -784,5 +784,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(RotationalSpeed)) + return this; + else if(conversionType == typeof(RotationalSpeedUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs index c85dc7c89a..f73d42da16 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs @@ -614,5 +614,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(RotationalStiffness)) + return this; + else if(conversionType == typeof(RotationalStiffnessUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs index 977440ed79..4b2709fcfa 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs @@ -614,5 +614,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(RotationalStiffnessPerLength)) + return this; + else if(conversionType == typeof(RotationalStiffnessPerLengthUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs index d2a27d85c9..250a3b075f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs @@ -583,5 +583,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SolidAngle)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SolidAngle)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SolidAngle)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(SolidAngle)) + return this; + else if(conversionType == typeof(SolidAngleUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(SolidAngle)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs index 3703e3b3c9..e358911be5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs @@ -719,5 +719,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(SpecificEnergy)) + return this; + else if(conversionType == typeof(SpecificEnergyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs index 60cad92d7c..cda08bef8b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs @@ -699,5 +699,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(SpecificEntropy)) + return this; + else if(conversionType == typeof(SpecificEntropyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs index f9a0d75ea9..ab93568173 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs @@ -614,5 +614,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(SpecificVolume)) + return this; + else if(conversionType == typeof(SpecificVolumeUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs index bedc38f78a..98b95d8ffb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs @@ -855,5 +855,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(SpecificWeight)) + return this; + else if(conversionType == typeof(SpecificWeightUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs index 76cb7ebae1..0b3d674972 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs @@ -1107,5 +1107,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Speed)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Speed)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Speed)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Speed)) + return this; + else if(conversionType == typeof(SpeedUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Speed)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs index 69093d925a..17ea458de1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs @@ -699,5 +699,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Temperature)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Temperature)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Temperature)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Temperature)) + return this; + else if(conversionType == typeof(TemperatureUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Temperature)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs index b3c5128afa..96514d2f7b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs @@ -733,5 +733,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(TemperatureChangeRate)) + return this; + else if(conversionType == typeof(TemperatureChangeRateUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs index a29737d0c5..82e0ff13a5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs @@ -699,5 +699,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(TemperatureDelta)) + return this; + else if(conversionType == typeof(TemperatureDeltaUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs index ebc1d99a6b..47a2c0af57 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs @@ -600,5 +600,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ThermalConductivity)) + return this; + else if(conversionType == typeof(ThermalConductivityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs index eb7d660fdb..fe1d9a6ce9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs @@ -648,5 +648,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ThermalResistance)) + return this; + else if(conversionType == typeof(ThermalResistanceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs index c0d5902656..b456c5d5bf 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs @@ -920,5 +920,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Torque)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Torque)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Torque)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Torque)) + return this; + else if(conversionType == typeof(TorqueUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Torque)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs index 1bb83af3e0..c035576365 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs @@ -580,5 +580,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(VitaminA)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(VitaminA)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(VitaminA)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(VitaminA)) + return this; + else if(conversionType == typeof(VitaminAUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(VitaminA)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs index 05cfda206c..be2d9d4f21 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs @@ -1328,5 +1328,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Volume)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Volume)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Volume)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Volume)) + return this; + else if(conversionType == typeof(VolumeUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Volume)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs index e46f4ff131..72388405db 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs @@ -1379,5 +1379,103 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(VolumeFlow)) + return this; + else if(conversionType == typeof(VolumeFlowUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index c270945249..0894adbc77 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Acceleration, in physics, is the rate at which the velocity of an object changes over time. An object's acceleration is the net result of any and all forces acting on the object, as described by Newton's Second Law. The SI unit for acceleration is the Meter per second squared (m/s²). Accelerations are vector quantities (they have magnitude and direction) and add according to the parallelogram law. As a vector, the calculated net force is equal to the product of the object's mass (a scalar quantity) and the acceleration. /// - public partial struct Acceleration : IQuantity, IEquatable, IComparable, IComparable + public partial struct Acceleration : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -811,5 +811,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Acceleration)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Acceleration)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Acceleration)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Acceleration)) + return this; + else if(conversionType == typeof(AccelerationUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Acceleration)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index 269ec5fc28..00eac0d250 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Mole is the amount of substance containing Avagadro's Number (6.02 x 10 ^ 23) of real particles such as molecules,atoms, ions or radicals. /// - public partial struct AmountOfSubstance : IQuantity, IEquatable, IComparable, IComparable + public partial struct AmountOfSubstance : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -843,5 +843,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(AmountOfSubstance)) + return this; + else if(conversionType == typeof(AmountOfSubstanceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs index bdd2811a3c..e7bc5e677e 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The strength of a signal expressed in decibels (dB) relative to one volt RMS. /// - public partial struct AmplitudeRatio : IQuantity, IEquatable, IComparable, IComparable + public partial struct AmplitudeRatio : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -675,5 +675,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(AmplitudeRatio)) + return this; + else if(conversionType == typeof(AmplitudeRatioUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index a40146322e..13f5a9497a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In geometry, an angle is the figure formed by two rays, called the sides of the angle, sharing a common endpoint, called the vertex of the angle. /// - public partial struct Angle : IQuantity, IEquatable, IComparable, IComparable + public partial struct Angle : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -827,5 +827,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Angle)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Angle)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Angle)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Angle)) + return this; + else if(conversionType == typeof(AngleUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Angle)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index d316073a1e..6130bcd0c6 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// A unit for expressing the integral of apparent power over time, equal to the product of 1 volt-ampere and 1 hour, or to 3600 joules. /// - public partial struct ApparentEnergy : IQuantity, IEquatable, IComparable, IComparable + public partial struct ApparentEnergy : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -651,5 +651,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ApparentEnergy)) + return this; + else if(conversionType == typeof(ApparentEnergyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index 939303cc36..0033f90201 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Power engineers measure apparent power as the magnitude of the vector sum of active and reactive power. Apparent power is the product of the root-mean-square of voltage and current. /// - public partial struct ApparentPower : IQuantity, IEquatable, IComparable, IComparable + public partial struct ApparentPower : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -667,5 +667,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ApparentPower)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ApparentPower)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ApparentPower)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ApparentPower)) + return this; + else if(conversionType == typeof(ApparentPowerUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ApparentPower)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index cc853e61b1..bcd536a8fa 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Area is a quantity that expresses the extent of a two-dimensional surface or shape, or planar lamina, in the plane. Area can be understood as the amount of material with a given thickness that would be necessary to fashion a model of the shape, or the amount of paint necessary to cover the surface with a single coat.[1] It is the two-dimensional analog of the length of a curve (a one-dimensional concept) or the volume of a solid (a three-dimensional concept). /// - public partial struct Area : IQuantity, IEquatable, IComparable, IComparable + public partial struct Area : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -811,5 +811,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Area)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Area)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Area)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Area)) + return this; + else if(conversionType == typeof(AreaUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Area)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index 981c3c9181..9235ae80ca 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The area density of a two-dimensional object is calculated as the mass per unit area. /// - public partial struct AreaDensity : IQuantity, IEquatable, IComparable, IComparable + public partial struct AreaDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -619,5 +619,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AreaDensity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AreaDensity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AreaDensity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(AreaDensity)) + return this; + else if(conversionType == typeof(AreaDensityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(AreaDensity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index 94a6104b6f..e5558eff6b 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// A geometric property of an area that reflects how its points are distributed with regard to an axis. /// - public partial struct AreaMomentOfInertia : IQuantity, IEquatable, IComparable, IComparable + public partial struct AreaMomentOfInertia : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -699,5 +699,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(AreaMomentOfInertia)) + return this; + else if(conversionType == typeof(AreaMomentOfInertiaUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs index 0b5970dc41..4d89af749d 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Bit_rate /// - public partial struct BitRate : IQuantity, IEquatable, IComparable, IComparable + public partial struct BitRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -1022,5 +1022,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(BitRate)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(BitRate)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(BitRate)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(BitRate)) + return this; + else if(conversionType == typeof(BitRateUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(BitRate)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index a426b07efc..4ecaa2809d 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Brake specific fuel consumption (BSFC) is a measure of the fuel efficiency of any prime mover that burns fuel and produces rotational, or shaft, power. It is typically used for comparing the efficiency of internal combustion engines with a shaft output. /// - public partial struct BrakeSpecificFuelConsumption : IQuantity, IEquatable, IComparable, IComparable + public partial struct BrakeSpecificFuelConsumption : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -651,5 +651,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(BrakeSpecificFuelConsumption)) + return this; + else if(conversionType == typeof(BrakeSpecificFuelConsumptionUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs index 781139ac3a..aa02f62881 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Capacitance /// - public partial struct Capacitance : IQuantity, IEquatable, IComparable, IComparable + public partial struct Capacitance : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -718,5 +718,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Capacitance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Capacitance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Capacitance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Capacitance)) + return this; + else if(conversionType == typeof(CapacitanceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Capacitance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs index 9e2c9d0169..f23d40531f 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// A unit that represents a fractional change in size in response to a change in temperature. /// - public partial struct CoefficientOfThermalExpansion : IQuantity, IEquatable, IComparable, IComparable + public partial struct CoefficientOfThermalExpansion : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -651,5 +651,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(CoefficientOfThermalExpansion)) + return this; + else if(conversionType == typeof(CoefficientOfThermalExpansionUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index 6bd675f67e..ec06d82986 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// http://en.wikipedia.org/wiki/Density /// - public partial struct Density : IQuantity, IEquatable, IComparable, IComparable + public partial struct Density : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -1230,5 +1230,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Density)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Density)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Density)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Density)) + return this; + else if(conversionType == typeof(DensityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Density)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index 96839e6452..34d7bc340e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Time is a dimension in which events can be ordered from the past through the present into the future, and also the measure of durations of events and the intervals between them. /// - public partial struct Duration : IQuantity, IEquatable, IComparable, IComparable + public partial struct Duration : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -763,5 +763,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Duration)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Duration)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Duration)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Duration)) + return this; + else if(conversionType == typeof(DurationUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Duration)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index d5c144c902..f938f5f963 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Viscosity#Dynamic_.28shear.29_viscosity /// - public partial struct DynamicViscosity : IQuantity, IEquatable, IComparable, IComparable + public partial struct DynamicViscosity : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -702,5 +702,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(DynamicViscosity)) + return this; + else if(conversionType == typeof(DynamicViscosityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs index 4fab6a781f..2917fd0db7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Electric admittance is a measure of how easily a circuit or device will allow a current to flow. It is defined as the inverse of impedance. The SI unit of admittance is the siemens (symbol S). /// - public partial struct ElectricAdmittance : IQuantity, IEquatable, IComparable, IComparable + public partial struct ElectricAdmittance : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -667,5 +667,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricAdmittance)) + return this; + else if(conversionType == typeof(ElectricAdmittanceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs index fb1cf38f61..da91c054d5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electric_charge /// - public partial struct ElectricCharge : IQuantity, IEquatable, IComparable, IComparable + public partial struct ElectricCharge : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -622,5 +622,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricCharge)) + return this; + else if(conversionType == typeof(ElectricChargeUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index 461b8d9b04..224df0f3a4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Charge_density /// - public partial struct ElectricChargeDensity : IQuantity, IEquatable, IComparable, IComparable + public partial struct ElectricChargeDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -622,5 +622,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricChargeDensity)) + return this; + else if(conversionType == typeof(ElectricChargeDensityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs index e1fe29fffd..7e9ec30260 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electrical_resistance_and_conductance /// - public partial struct ElectricConductance : IQuantity, IEquatable, IComparable, IComparable + public partial struct ElectricConductance : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -654,5 +654,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricConductance)) + return this; + else if(conversionType == typeof(ElectricConductanceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs index be0f11ec85..85d4134494 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity /// - public partial struct ElectricConductivity : IQuantity, IEquatable, IComparable, IComparable + public partial struct ElectricConductivity : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -622,5 +622,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricConductivity)) + return this; + else if(conversionType == typeof(ElectricConductivityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs index 363b81c633..123b420ce4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// An electric current is a flow of electric charge. In electric circuits this charge is often carried by moving electrons in a wire. It can also be carried by ions in an electrolyte, or by both ions and electrons such as in a plasma. /// - public partial struct ElectricCurrent : IQuantity, IEquatable, IComparable, IComparable + public partial struct ElectricCurrent : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -731,5 +731,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricCurrent)) + return this; + else if(conversionType == typeof(ElectricCurrentUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs index b7001e7b26..becbef2079 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Current_density /// - public partial struct ElectricCurrentDensity : IQuantity, IEquatable, IComparable, IComparable + public partial struct ElectricCurrentDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -622,5 +622,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricCurrentDensity)) + return this; + else if(conversionType == typeof(ElectricCurrentDensityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs index 4bb134d584..af9d802481 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In electromagnetism, the current gradient describes how the current changes in time. /// - public partial struct ElectricCurrentGradient : IQuantity, IEquatable, IComparable, IComparable + public partial struct ElectricCurrentGradient : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -619,5 +619,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricCurrentGradient)) + return this; + else if(conversionType == typeof(ElectricCurrentGradientUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs index 4b6fdb2dbf..48cbf1fdf6 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electric_field /// - public partial struct ElectricField : IQuantity, IEquatable, IComparable, IComparable + public partial struct ElectricField : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -622,5 +622,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricField)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricField)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricField)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricField)) + return this; + else if(conversionType == typeof(ElectricFieldUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricField)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index 80df2fca68..8b5c081d7a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Inductance /// - public partial struct ElectricInductance : IQuantity, IEquatable, IComparable, IComparable + public partial struct ElectricInductance : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -670,5 +670,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricInductance)) + return this; + else if(conversionType == typeof(ElectricInductanceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs index cd2d3b1af4..e9907db8ae 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In classical electromagnetism, the electric potential (a scalar quantity denoted by Φ, ΦE or V and also called the electric field potential or the electrostatic potential) at a point is the amount of electric potential energy that a unitary point charge would have when located at that point. /// - public partial struct ElectricPotential : IQuantity, IEquatable, IComparable, IComparable + public partial struct ElectricPotential : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -683,5 +683,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricPotential)) + return this; + else if(conversionType == typeof(ElectricPotentialUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs index fd40d4efdd..7900d3a4cc 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The Electric Potential of a system known to use Alternating Current. /// - public partial struct ElectricPotentialAc : IQuantity, IEquatable, IComparable, IComparable + public partial struct ElectricPotentialAc : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -683,5 +683,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricPotentialAc)) + return this; + else if(conversionType == typeof(ElectricPotentialAcUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs index fd30ab0765..8158f22cc3 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The Electric Potential of a system known to use Direct Current. /// - public partial struct ElectricPotentialDc : IQuantity, IEquatable, IComparable, IComparable + public partial struct ElectricPotentialDc : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -683,5 +683,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricPotentialDc)) + return this; + else if(conversionType == typeof(ElectricPotentialDcUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs index d2ea46101d..1aee8ef8eb 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The electrical resistance of an electrical conductor is the opposition to the passage of an electric current through that conductor. /// - public partial struct ElectricResistance : IQuantity, IEquatable, IComparable, IComparable + public partial struct ElectricResistance : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -683,5 +683,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricResistance)) + return this; + else if(conversionType == typeof(ElectricResistanceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs index e4771a7041..e61dccae25 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity /// - public partial struct ElectricResistivity : IQuantity, IEquatable, IComparable, IComparable + public partial struct ElectricResistivity : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -830,5 +830,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ElectricResistivity)) + return this; + else if(conversionType == typeof(ElectricResistivityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs index b6b7eb3cc2..38c4fa0423 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The joule, symbol J, is a derived unit of energy, work, or amount of heat in the International System of Units. It is equal to the energy transferred (or work done) when applying a force of one newton through a distance of one metre (1 newton metre or N·m), or in passing an electric current of one ampere through a resistance of one ohm for one second. Many other units of energy are included. Please do not confuse this definition of the calorie with the one colloquially used by the food industry, the large calorie, which is equivalent to 1 kcal. Thermochemical definition of the calorie is used. For BTU, the IT definition is used. /// - public partial struct Energy : IQuantity, IEquatable, IComparable, IComparable + public partial struct Energy : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -955,5 +955,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Energy)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Energy)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Energy)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Energy)) + return this; + else if(conversionType == typeof(EnergyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Energy)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index 4662db9594..233c94b939 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Entropy is an important concept in the branch of science known as thermodynamics. The idea of "irreversibility" is central to the understanding of entropy. It is often said that entropy is an expression of the disorder, or randomness of a system, or of our lack of information about it. Entropy is an extensive property. It has the dimension of energy divided by temperature, which has a unit of joules per kelvin (J/K) in the International System of Units /// - public partial struct Entropy : IQuantity, IEquatable, IComparable, IComparable + public partial struct Entropy : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -715,5 +715,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Entropy)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Entropy)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Entropy)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Entropy)) + return this; + else if(conversionType == typeof(EntropyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Entropy)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index 6ebd52954a..59d22fce3a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In physics, a force is any influence that causes an object to undergo a certain change, either concerning its movement, direction, or geometrical construction. In other words, a force can cause an object with mass to change its velocity (which includes to begin moving from a state of rest), i.e., to accelerate, or a flexible object to deform, or both. Force can also be described by intuitive concepts such as a push or a pull. A force has both magnitude and direction, making it a vector quantity. It is measured in the SI unit of newtons and represented by the symbol F. /// - public partial struct Force : IQuantity, IEquatable, IComparable, IComparable + public partial struct Force : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -811,5 +811,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Force)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Force)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Force)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Force)) + return this; + else if(conversionType == typeof(ForceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Force)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index af21f65c43..8f43869b36 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Force change rate is the ratio of the force change to the time during which the change occurred (value of force changes per unit time). /// - public partial struct ForceChangeRate : IQuantity, IEquatable, IComparable, IComparable + public partial struct ForceChangeRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -779,5 +779,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ForceChangeRate)) + return this; + else if(conversionType == typeof(ForceChangeRateUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs index 8f60b98ec5..6cb0f3ea96 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The magnitude of force per unit length. /// - public partial struct ForcePerLength : IQuantity, IEquatable, IComparable, IComparable + public partial struct ForcePerLength : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -747,5 +747,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ForcePerLength)) + return this; + else if(conversionType == typeof(ForcePerLengthUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index 10885386a6..f5e9e8756a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The number of occurrences of a repeating event per unit time. /// - public partial struct Frequency : IQuantity, IEquatable, IComparable, IComparable + public partial struct Frequency : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -731,5 +731,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Frequency)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Frequency)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Frequency)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Frequency)) + return this; + else if(conversionType == typeof(FrequencyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Frequency)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index efa64bfcd3..f549a58a4d 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Heat flux is the flow of energy per unit of area per unit of time /// - public partial struct HeatFlux : IQuantity, IEquatable, IComparable, IComparable + public partial struct HeatFlux : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -891,5 +891,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(HeatFlux)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(HeatFlux)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(HeatFlux)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(HeatFlux)) + return this; + else if(conversionType == typeof(HeatFluxUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(HeatFlux)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index 06ca66abcf..d1b0d0f59e 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The heat transfer coefficient or film coefficient, or film effectiveness, in thermodynamics and in mechanics is the proportionality constant between the heat flux and the thermodynamic driving force for the flow of heat (i.e., the temperature difference, ΔT) /// - public partial struct HeatTransferCoefficient : IQuantity, IEquatable, IComparable, IComparable + public partial struct HeatTransferCoefficient : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -635,5 +635,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(HeatTransferCoefficient)) + return this; + else if(conversionType == typeof(HeatTransferCoefficientUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs index deb0dfd964..459ebbc178 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Illuminance /// - public partial struct Illuminance : IQuantity, IEquatable, IComparable, IComparable + public partial struct Illuminance : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -670,5 +670,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Illuminance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Illuminance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Illuminance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Illuminance)) + return this; + else if(conversionType == typeof(IlluminanceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Illuminance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index 33ae00e2bc..6a70cfabb3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In computing and telecommunications, a unit of information is the capacity of some standard data storage system or communication channel, used to measure the capacities of other systems and channels. In information theory, units of information are also used to measure the information contents or entropy of random variables. /// - public partial struct Information : IQuantity, IEquatable, IComparable, IComparable + public partial struct Information : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -1019,5 +1019,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Information)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Information)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Information)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Information)) + return this; + else if(conversionType == typeof(InformationUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Information)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index ac2f12ef3d..a33c54eaf9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Irradiance is the intensity of ultraviolet (UV) or visible light incident on a surface. /// - public partial struct Irradiance : IQuantity, IEquatable, IComparable, IComparable + public partial struct Irradiance : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -827,5 +827,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Irradiance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Irradiance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Irradiance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Irradiance)) + return this; + else if(conversionType == typeof(IrradianceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Irradiance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index dca928f3c6..8f4c410384 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Irradiation /// - public partial struct Irradiation : IQuantity, IEquatable, IComparable, IComparable + public partial struct Irradiation : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -670,5 +670,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Irradiation)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Irradiation)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Irradiation)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Irradiation)) + return this; + else if(conversionType == typeof(IrradiationUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Irradiation)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index 2706ee8908..d597c8c20e 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// http://en.wikipedia.org/wiki/Viscosity /// - public partial struct KinematicViscosity : IQuantity, IEquatable, IComparable, IComparable + public partial struct KinematicViscosity : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -734,5 +734,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(KinematicViscosity)) + return this; + else if(conversionType == typeof(KinematicViscosityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs index 32917196b5..40799c1995 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Lapse rate is the rate at which Earth's atmospheric temperature decreases with an increase in altitude, or increases with the decrease in altitude. /// - public partial struct LapseRate : IQuantity, IEquatable, IComparable, IComparable + public partial struct LapseRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -619,5 +619,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LapseRate)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LapseRate)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LapseRate)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(LapseRate)) + return this; + else if(conversionType == typeof(LapseRateUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(LapseRate)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index b99f958318..232a2819a7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Many different units of length have been used around the world. The main units in modern use are U.S. customary units in the United States and the Metric system elsewhere. British Imperial units are still used for some purposes in the United Kingdom and some other countries. The metric system is sub-divided into SI and non-SI units. /// - public partial struct Length : IQuantity, IEquatable, IComparable, IComparable + public partial struct Length : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -955,5 +955,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Length)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Length)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Length)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Length)) + return this; + else if(conversionType == typeof(LengthUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Length)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index 2341a73eb2..6a3f119d39 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Level is the logarithm of the ratio of a quantity Q to a reference value of that quantity, Q₀, expressed in dimensionless units. /// - public partial struct Level : IQuantity, IEquatable, IComparable, IComparable + public partial struct Level : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -643,5 +643,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Level)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Level)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Level)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Level)) + return this; + else if(conversionType == typeof(LevelUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Level)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index 2181591ddb..6bd65fe7b4 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// http://en.wikipedia.org/wiki/Linear_density /// - public partial struct LinearDensity : IQuantity, IEquatable, IComparable, IComparable + public partial struct LinearDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -654,5 +654,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LinearDensity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LinearDensity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LinearDensity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(LinearDensity)) + return this; + else if(conversionType == typeof(LinearDensityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(LinearDensity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index b607dcf7d5..1a2c4f8caa 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Luminous_flux /// - public partial struct LuminousFlux : IQuantity, IEquatable, IComparable, IComparable + public partial struct LuminousFlux : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -622,5 +622,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(LuminousFlux)) + return this; + else if(conversionType == typeof(LuminousFluxUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index 140d69e819..e083023e5f 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Luminous_intensity /// - public partial struct LuminousIntensity : IQuantity, IEquatable, IComparable, IComparable + public partial struct LuminousIntensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -622,5 +622,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(LuminousIntensity)) + return this; + else if(conversionType == typeof(LuminousIntensityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs index d41a947096..ae4343f863 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Magnetic_field /// - public partial struct MagneticField : IQuantity, IEquatable, IComparable, IComparable + public partial struct MagneticField : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -670,5 +670,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MagneticField)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MagneticField)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MagneticField)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(MagneticField)) + return this; + else if(conversionType == typeof(MagneticFieldUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(MagneticField)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index dbdd27fde0..aa4e0dd883 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Magnetic_flux /// - public partial struct MagneticFlux : IQuantity, IEquatable, IComparable, IComparable + public partial struct MagneticFlux : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -622,5 +622,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(MagneticFlux)) + return this; + else if(conversionType == typeof(MagneticFluxUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index 176584354c..3b0eedd136 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Magnetization /// - public partial struct Magnetization : IQuantity, IEquatable, IComparable, IComparable + public partial struct Magnetization : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -622,5 +622,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Magnetization)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Magnetization)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Magnetization)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Magnetization)) + return this; + else if(conversionType == typeof(MagnetizationUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Magnetization)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index db50819870..51979b02be 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In physics, mass (from Greek μᾶζα "barley cake, lump [of dough]") is a property of a physical system or body, giving rise to the phenomena of the body's resistance to being accelerated by a force and the strength of its mutual gravitational attraction with other bodies. Instruments such as mass balances or scales use those phenomena to measure mass. The SI unit of mass is the kilogram (kg). /// - public partial struct Mass : IQuantity, IEquatable, IComparable, IComparable + public partial struct Mass : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -971,5 +971,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Mass)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Mass)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Mass)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Mass)) + return this; + else if(conversionType == typeof(MassUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Mass)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index 506ff0ba9d..1863787ef7 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Mass flow is the ratio of the mass change to the time during which the change occurred (value of mass changes per unit time). /// - public partial struct MassFlow : IQuantity, IEquatable, IComparable, IComparable + public partial struct MassFlow : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -1099,5 +1099,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassFlow)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassFlow)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassFlow)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(MassFlow)) + return this; + else if(conversionType == typeof(MassFlowUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(MassFlow)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index 0c811035cf..0ec968a514 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Mass flux is the mass flow rate per unit area. /// - public partial struct MassFlux : IQuantity, IEquatable, IComparable, IComparable + public partial struct MassFlux : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -635,5 +635,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassFlux)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassFlux)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassFlux)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(MassFlux)) + return this; + else if(conversionType == typeof(MassFluxUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(MassFlux)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index 82b43eb65f..108e96a1c8 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// A property of body reflects how its mass is distributed with regard to an axis. /// - public partial struct MassMomentOfInertia : IQuantity, IEquatable, IComparable, IComparable + public partial struct MassMomentOfInertia : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -1051,5 +1051,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(MassMomentOfInertia)) + return this; + else if(conversionType == typeof(MassMomentOfInertiaUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs index dfa6b62b6d..b90932ff4e 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Molar energy is the amount of energy stored in 1 mole of a substance. /// - public partial struct MolarEnergy : IQuantity, IEquatable, IComparable, IComparable + public partial struct MolarEnergy : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -651,5 +651,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(MolarEnergy)) + return this; + else if(conversionType == typeof(MolarEnergyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index fd1a3c6263..f42a12dd75 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Molar entropy is amount of energy required to increase temperature of 1 mole substance by 1 Kelvin. /// - public partial struct MolarEntropy : IQuantity, IEquatable, IComparable, IComparable + public partial struct MolarEntropy : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -651,5 +651,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(MolarEntropy)) + return this; + else if(conversionType == typeof(MolarEntropyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index 4721d8b907..2de5ea05b2 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In chemistry, the molar mass M is a physical property defined as the mass of a given substance (chemical element or chemical compound) divided by the amount of substance. /// - public partial struct MolarMass : IQuantity, IEquatable, IComparable, IComparable + public partial struct MolarMass : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -795,5 +795,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarMass)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarMass)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(MolarMass)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(MolarMass)) + return this; + else if(conversionType == typeof(MolarMassUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(MolarMass)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index 9094636403..2e71b83003 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Molar_concentration /// - public partial struct Molarity : IQuantity, IEquatable, IComparable, IComparable + public partial struct Molarity : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -734,5 +734,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Molarity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Molarity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Molarity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Molarity)) + return this; + else if(conversionType == typeof(MolarityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Molarity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index 02ab452db7..d3f59f79d9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Permeability_(electromagnetism) /// - public partial struct Permeability : IQuantity, IEquatable, IComparable, IComparable + public partial struct Permeability : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -622,5 +622,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Permeability)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Permeability)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Permeability)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Permeability)) + return this; + else if(conversionType == typeof(PermeabilityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Permeability)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index 1e70c4a242..d50bae7dd5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Permittivity /// - public partial struct Permittivity : IQuantity, IEquatable, IComparable, IComparable + public partial struct Permittivity : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -622,5 +622,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Permittivity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Permittivity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Permittivity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Permittivity)) + return this; + else if(conversionType == typeof(PermittivityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Permittivity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index 18faeda9a1..d9eaa32d05 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In physics, power is the rate of doing work. It is equivalent to an amount of energy consumed per unit time. /// - public partial struct Power : IQuantity, IEquatable, IComparable, IComparable + public partial struct Power : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -923,5 +923,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Power)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Power)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Power)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Power)) + return this; + else if(conversionType == typeof(PowerUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Power)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index 9eba92a219..91bcd3ba52 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The amount of power in a volume. /// - public partial struct PowerDensity : IQuantity, IEquatable, IComparable, IComparable + public partial struct PowerDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -1307,5 +1307,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PowerDensity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PowerDensity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PowerDensity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(PowerDensity)) + return this; + else if(conversionType == typeof(PowerDensityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(PowerDensity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index b3c113cf13..2ccdddc214 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The strength of a signal expressed in decibels (dB) relative to one watt. /// - public partial struct PowerRatio : IQuantity, IEquatable, IComparable, IComparable + public partial struct PowerRatio : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -643,5 +643,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PowerRatio)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PowerRatio)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PowerRatio)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(PowerRatio)) + return this; + else if(conversionType == typeof(PowerRatioUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(PowerRatio)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index 0d47de1c2a..fffd37756e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Pressure (symbol: P or p) is the ratio of force to the area over which that force is distributed. Pressure is force per unit area applied in a direction perpendicular to the surface of an object. Gauge pressure (also spelled gage pressure)[a] is the pressure relative to the local atmospheric or ambient pressure. Pressure is measured in any unit of force divided by any unit of area. The SI unit of pressure is the newton per square metre, which is called the pascal (Pa) after the seventeenth-century philosopher and scientist Blaise Pascal. A pressure of 1 Pa is small; it approximately equals the pressure exerted by a dollar bill resting flat on a table. Everyday pressures are often stated in kilopascals (1 kPa = 1000 Pa). /// - public partial struct Pressure : IQuantity, IEquatable, IComparable, IComparable + public partial struct Pressure : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -1275,5 +1275,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Pressure)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Pressure)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Pressure)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Pressure)) + return this; + else if(conversionType == typeof(PressureUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Pressure)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index 3bb2d8a080..5008809856 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Pressure change rate is the ratio of the pressure change to the time during which the change occurred (value of pressure changes per unit time). /// - public partial struct PressureChangeRate : IQuantity, IEquatable, IComparable, IComparable + public partial struct PressureChangeRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -715,5 +715,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(PressureChangeRate)) + return this; + else if(conversionType == typeof(PressureChangeRateUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs index cd4a096efc..37f3d37761 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In mathematics, a ratio is a relationship between two numbers of the same kind (e.g., objects, persons, students, spoonfuls, units of whatever identical dimension), usually expressed as "a to b" or a:b, sometimes expressed arithmetically as a dimensionless quotient of the two that explicitly indicates how many times the first number contains the second (not necessarily an integer). /// - public partial struct Ratio : IQuantity, IEquatable, IComparable, IComparable + public partial struct Ratio : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -699,5 +699,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Ratio)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Ratio)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Ratio)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Ratio)) + return this; + else if(conversionType == typeof(RatioUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Ratio)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index 9b994dd9b5..90843c6ba1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The Volt-ampere reactive hour (expressed as varh) is the reactive power of one Volt-ampere reactive produced in one hour. /// - public partial struct ReactiveEnergy : IQuantity, IEquatable, IComparable, IComparable + public partial struct ReactiveEnergy : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -651,5 +651,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ReactiveEnergy)) + return this; + else if(conversionType == typeof(ReactiveEnergyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index f96d7f69f9..f90ea993f5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Volt-ampere reactive (var) is a unit by which reactive power is expressed in an AC electric power system. Reactive power exists in an AC circuit when the current and voltage are not in phase. /// - public partial struct ReactivePower : IQuantity, IEquatable, IComparable, IComparable + public partial struct ReactivePower : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -667,5 +667,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ReactivePower)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ReactivePower)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ReactivePower)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ReactivePower)) + return this; + else if(conversionType == typeof(ReactivePowerUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ReactivePower)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index 54f5c82f10..dce3a12285 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Angular acceleration is the rate of change of rotational speed. /// - public partial struct RotationalAcceleration : IQuantity, IEquatable, IComparable, IComparable + public partial struct RotationalAcceleration : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -651,5 +651,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(RotationalAcceleration)) + return this; + else if(conversionType == typeof(RotationalAccelerationUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs index c516604501..78a671e6b6 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Rotational speed (sometimes called speed of revolution) is the number of complete rotations, revolutions, cycles, or turns per time unit. Rotational speed is a cyclic frequency, measured in radians per second or in hertz in the SI System by scientists, or in revolutions per minute (rpm or min-1) or revolutions per second in everyday life. The symbol for rotational speed is ω (the Greek lowercase letter "omega"). /// - public partial struct RotationalSpeed : IQuantity, IEquatable, IComparable, IComparable + public partial struct RotationalSpeed : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -811,5 +811,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(RotationalSpeed)) + return this; + else if(conversionType == typeof(RotationalSpeedUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs index 06f27db81a..9225a807bf 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness /// - public partial struct RotationalStiffness : IQuantity, IEquatable, IComparable, IComparable + public partial struct RotationalStiffness : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -651,5 +651,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(RotationalStiffness)) + return this; + else if(conversionType == typeof(RotationalStiffnessUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs index ff246b845e..529de0b6a2 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness /// - public partial struct RotationalStiffnessPerLength : IQuantity, IEquatable, IComparable, IComparable + public partial struct RotationalStiffnessPerLength : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -651,5 +651,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(RotationalStiffnessPerLength)) + return this; + else if(conversionType == typeof(RotationalStiffnessPerLengthUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs index 0c2249eac2..73fe45b442 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Solid_angle /// - public partial struct SolidAngle : IQuantity, IEquatable, IComparable, IComparable + public partial struct SolidAngle : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -622,5 +622,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SolidAngle)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SolidAngle)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SolidAngle)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(SolidAngle)) + return this; + else if(conversionType == typeof(SolidAngleUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(SolidAngle)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index 73bf333040..c093257e57 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Specific_energy /// - public partial struct SpecificEnergy : IQuantity, IEquatable, IComparable, IComparable + public partial struct SpecificEnergy : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -750,5 +750,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(SpecificEnergy)) + return this; + else if(conversionType == typeof(SpecificEnergyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index 71da6779bb..5f7d9ee1d8 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Specific entropy is an amount of energy required to raise temperature of a substance by 1 Kelvin per unit mass. /// - public partial struct SpecificEntropy : IQuantity, IEquatable, IComparable, IComparable + public partial struct SpecificEntropy : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -731,5 +731,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(SpecificEntropy)) + return this; + else if(conversionType == typeof(SpecificEntropyUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs index fc308ee2d8..40da586ea8 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In thermodynamics, the specific volume of a substance is the ratio of the substance's volume to its mass. It is the reciprocal of density and an intrinsic property of matter as well. /// - public partial struct SpecificVolume : IQuantity, IEquatable, IComparable, IComparable + public partial struct SpecificVolume : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -651,5 +651,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(SpecificVolume)) + return this; + else if(conversionType == typeof(SpecificVolumeUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index 919f43f045..a319dbf64a 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// http://en.wikipedia.org/wiki/Specificweight /// - public partial struct SpecificWeight : IQuantity, IEquatable, IComparable, IComparable + public partial struct SpecificWeight : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -878,5 +878,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(SpecificWeight)) + return this; + else if(conversionType == typeof(SpecificWeightUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index 9a3f4a5cc2..811a8e1a35 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In everyday use and in kinematics, the speed of an object is the magnitude of its velocity (the rate of change of its position); it is thus a scalar quantity.[1] The average speed of an object in an interval of time is the distance travelled by the object divided by the duration of the interval;[2] the instantaneous speed is the limit of the average speed as the duration of the time interval approaches zero. /// - public partial struct Speed : IQuantity, IEquatable, IComparable, IComparable + public partial struct Speed : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -1115,5 +1115,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Speed)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Speed)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Speed)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Speed)) + return this; + else if(conversionType == typeof(SpeedUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Speed)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index db0438e785..54f2e36f73 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// A temperature is a numerical measure of hot or cold. Its measurement is by detection of heat radiation or particle velocity or kinetic energy, or by the bulk behavior of a thermometric material. It may be calibrated in any of various temperature scales, Celsius, Fahrenheit, Kelvin, etc. The fundamental physical definition of temperature is provided by thermodynamics. /// - public partial struct Temperature : IQuantity, IEquatable, IComparable, IComparable + public partial struct Temperature : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -692,5 +692,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Temperature)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Temperature)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Temperature)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Temperature)) + return this; + else if(conversionType == typeof(TemperatureUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Temperature)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index 0a5d7ac439..19880cf480 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Temperature change rate is the ratio of the temperature change to the time during which the change occurred (value of temperature changes per unit time). /// - public partial struct TemperatureChangeRate : IQuantity, IEquatable, IComparable, IComparable + public partial struct TemperatureChangeRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -763,5 +763,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(TemperatureChangeRate)) + return this; + else if(conversionType == typeof(TemperatureChangeRateUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index 84fe4d07aa..2851b58f52 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Difference between two temperatures. The conversions are different than for Temperature. /// - public partial struct TemperatureDelta : IQuantity, IEquatable, IComparable, IComparable + public partial struct TemperatureDelta : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -731,5 +731,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(TemperatureDelta)) + return this; + else if(conversionType == typeof(TemperatureDeltaUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs index a722655da4..32d714b4f2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Thermal_Conductivity /// - public partial struct ThermalConductivity : IQuantity, IEquatable, IComparable, IComparable + public partial struct ThermalConductivity : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -638,5 +638,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ThermalConductivity)) + return this; + else if(conversionType == typeof(ThermalConductivityUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs index d5f8841be7..0a815295c6 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Heat Transfer Coefficient or Thermal conductivity - indicates a materials ability to conduct heat. /// - public partial struct ThermalResistance : IQuantity, IEquatable, IComparable, IComparable + public partial struct ThermalResistance : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -683,5 +683,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(ThermalResistance)) + return this; + else if(conversionType == typeof(ThermalResistanceUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs index 322b8cad4c..a060449e08 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Torque, moment or moment of force (see the terminology below), is the tendency of a force to rotate an object about an axis,[1] fulcrum, or pivot. Just as a force is a push or a pull, a torque can be thought of as a twist to an object. Mathematically, torque is defined as the cross product of the lever-arm distance and force, which tends to produce rotation. Loosely speaking, torque is a measure of the turning force on an object such as a bolt or a flywheel. For example, pushing or pulling the handle of a wrench connected to a nut or bolt produces a torque (turning force) that loosens or tightens the nut or bolt. /// - public partial struct Torque : IQuantity, IEquatable, IComparable, IComparable + public partial struct Torque : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -939,5 +939,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Torque)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Torque)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Torque)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Torque)) + return this; + else if(conversionType == typeof(TorqueUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Torque)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index 85a7585a8a..07d5e94bb7 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Vitamin A: 1 IU is the biological equivalent of 0.3 µg retinol, or of 0.6 µg beta-carotene. /// - public partial struct VitaminA : IQuantity, IEquatable, IComparable, IComparable + public partial struct VitaminA : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -619,5 +619,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(VitaminA)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(VitaminA)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(VitaminA)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(VitaminA)) + return this; + else if(conversionType == typeof(VitaminAUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(VitaminA)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index d77f36c23c..120f20c38a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Volume is the quantity of three-dimensional space enclosed by some closed boundary, for example, the space that a substance (solid, liquid, gas, or plasma) or shape occupies or contains.[1] Volume is often quantified numerically using the SI derived unit, the cubic metre. The volume of a container is generally understood to be the capacity of the container, i. e. the amount of fluid (gas or liquid) that the container could hold, rather than the amount of space the container itself displaces. /// - public partial struct Volume : IQuantity, IEquatable, IComparable, IComparable + public partial struct Volume : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -1323,5 +1323,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Volume)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Volume)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(Volume)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(Volume)) + return this; + else if(conversionType == typeof(VolumeUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(Volume)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index 701d37c3fc..1be624cb12 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q. /// - public partial struct VolumeFlow : IQuantity, IEquatable, IComparable, IComparable + public partial struct VolumeFlow : IQuantity, IEquatable, IComparable, IComparable, IConvertible { /// /// The numeric value this quantity was constructed with. @@ -1371,5 +1371,102 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #endregion + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(VolumeFlow)) + return this; + else if(conversionType == typeof(VolumeFlowUnit)) + return Unit; + + throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index d725bd7293..8fa0b2c951 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -99,7 +99,7 @@ if ($obsoleteAttribute) // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. public sealed partial class $quantityName : IQuantity "@; } else {@" - public partial struct $quantityName : IQuantity<$unitEnumName>, IEquatable<$quantityName>, IComparable, IComparable<$quantityName> + public partial struct $quantityName : IQuantity<$unitEnumName>, IEquatable<$quantityName>, IComparable, IComparable<$quantityName>, IConvertible "@; }@" { /// @@ -254,8 +254,105 @@ if ($obsoleteAttribute) { return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } -"@; } else {@" "@; }@" + + #region IConvertible Methods + +#if !WINDOWS_UWP + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof($quantityName)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof($quantityName)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof($quantityName)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString(provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof($quantityName)) + return this; + else if(conversionType == typeof($unitEnumName)) + return Unit; + + throw new InvalidCastException($"Converting {typeof($quantityName)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + +#endif + + #endregion } } "@; From 9844e29048cd140ad7d427220e233a31340c22ce Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 1 Feb 2019 10:37:46 -0500 Subject: [PATCH 2/3] Allow conversions to QuantityType and BaseDimensions --- UnitsNet.Tests/QuantityIConvertibleTests.cs | 9 ++++++++- .../Quantities/Acceleration.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../AmountOfSubstance.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../AmplitudeRatio.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Angle.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ApparentEnergy.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ApparentPower.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Area.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/AreaDensity.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../AreaMomentOfInertia.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/BitRate.WindowsRuntimeComponent.g.cs | 8 ++++++-- ...eSpecificFuelConsumption.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Capacitance.WindowsRuntimeComponent.g.cs | 8 ++++++-- ...icientOfThermalExpansion.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Density.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Duration.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../DynamicViscosity.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ElectricAdmittance.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ElectricCharge.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ElectricChargeDensity.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ElectricConductance.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ElectricConductivity.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ElectricCurrent.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ElectricCurrentDensity.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ElectricCurrentGradient.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ElectricField.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ElectricInductance.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ElectricPotential.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ElectricPotentialAc.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ElectricPotentialDc.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ElectricResistance.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ElectricResistivity.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Energy.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Entropy.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Force.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ForceChangeRate.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ForcePerLength.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Frequency.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/HeatFlux.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../HeatTransferCoefficient.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Illuminance.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Information.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Irradiance.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Irradiation.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../KinematicViscosity.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/LapseRate.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Length.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Level.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../LinearDensity.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../LuminousIntensity.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../MagneticField.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Magnetization.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Mass.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/MassFlow.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/MassFlux.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../MassMomentOfInertia.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/MolarMass.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Molarity.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Permeability.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Permittivity.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Power.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/PowerDensity.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/PowerRatio.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Pressure.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../PressureChangeRate.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Ratio.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ReactiveEnergy.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ReactivePower.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../RotationalAcceleration.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../RotationalSpeed.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../RotationalStiffness.WindowsRuntimeComponent.g.cs | 8 ++++++-- ...tionalStiffnessPerLength.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/SolidAngle.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../SpecificEnergy.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../SpecificEntropy.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../SpecificVolume.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../SpecificWeight.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Speed.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Temperature.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../TemperatureChangeRate.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../TemperatureDelta.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ThermalConductivity.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../ThermalResistance.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Torque.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/VitaminA.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Volume.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs | 8 ++++++-- .../Quantities/Acceleration.NetFramework.g.cs | 8 ++++++-- .../Quantities/AmountOfSubstance.NetFramework.g.cs | 8 ++++++-- .../Quantities/AmplitudeRatio.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/Angle.NetFramework.g.cs | 8 ++++++-- .../Quantities/ApparentEnergy.NetFramework.g.cs | 8 ++++++-- .../Quantities/ApparentPower.NetFramework.g.cs | 8 ++++++-- UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs | 8 ++++++-- .../Quantities/AreaDensity.NetFramework.g.cs | 8 ++++++-- .../Quantities/AreaMomentOfInertia.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/BitRate.NetFramework.g.cs | 8 ++++++-- .../BrakeSpecificFuelConsumption.NetFramework.g.cs | 8 ++++++-- .../Quantities/Capacitance.NetFramework.g.cs | 8 ++++++-- .../CoefficientOfThermalExpansion.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/Density.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/Duration.NetFramework.g.cs | 8 ++++++-- .../Quantities/DynamicViscosity.NetFramework.g.cs | 8 ++++++-- .../Quantities/ElectricAdmittance.NetFramework.g.cs | 8 ++++++-- .../Quantities/ElectricCharge.NetFramework.g.cs | 8 ++++++-- .../Quantities/ElectricChargeDensity.NetFramework.g.cs | 8 ++++++-- .../Quantities/ElectricConductance.NetFramework.g.cs | 8 ++++++-- .../Quantities/ElectricConductivity.NetFramework.g.cs | 8 ++++++-- .../Quantities/ElectricCurrent.NetFramework.g.cs | 8 ++++++-- .../Quantities/ElectricCurrentDensity.NetFramework.g.cs | 8 ++++++-- .../Quantities/ElectricCurrentGradient.NetFramework.g.cs | 8 ++++++-- .../Quantities/ElectricField.NetFramework.g.cs | 8 ++++++-- .../Quantities/ElectricInductance.NetFramework.g.cs | 8 ++++++-- .../Quantities/ElectricPotential.NetFramework.g.cs | 8 ++++++-- .../Quantities/ElectricPotentialAc.NetFramework.g.cs | 8 ++++++-- .../Quantities/ElectricPotentialDc.NetFramework.g.cs | 8 ++++++-- .../Quantities/ElectricResistance.NetFramework.g.cs | 8 ++++++-- .../Quantities/ElectricResistivity.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/Energy.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/Entropy.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/Force.NetFramework.g.cs | 8 ++++++-- .../Quantities/ForceChangeRate.NetFramework.g.cs | 8 ++++++-- .../Quantities/ForcePerLength.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/Frequency.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs | 8 ++++++-- .../Quantities/HeatTransferCoefficient.NetFramework.g.cs | 8 ++++++-- .../Quantities/Illuminance.NetFramework.g.cs | 8 ++++++-- .../Quantities/Information.NetFramework.g.cs | 8 ++++++-- .../Quantities/Irradiance.NetFramework.g.cs | 8 ++++++-- .../Quantities/Irradiation.NetFramework.g.cs | 8 ++++++-- .../Quantities/KinematicViscosity.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/LapseRate.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/Length.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/Level.NetFramework.g.cs | 8 ++++++-- .../Quantities/LinearDensity.NetFramework.g.cs | 8 ++++++-- .../Quantities/LuminousFlux.NetFramework.g.cs | 8 ++++++-- .../Quantities/LuminousIntensity.NetFramework.g.cs | 8 ++++++-- .../Quantities/MagneticField.NetFramework.g.cs | 8 ++++++-- .../Quantities/MagneticFlux.NetFramework.g.cs | 8 ++++++-- .../Quantities/Magnetization.NetFramework.g.cs | 8 ++++++-- UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/MassFlow.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/MassFlux.NetFramework.g.cs | 8 ++++++-- .../Quantities/MassMomentOfInertia.NetFramework.g.cs | 8 ++++++-- .../Quantities/MolarEnergy.NetFramework.g.cs | 8 ++++++-- .../Quantities/MolarEntropy.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/MolarMass.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/Molarity.NetFramework.g.cs | 8 ++++++-- .../Quantities/Permeability.NetFramework.g.cs | 8 ++++++-- .../Quantities/Permittivity.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/Power.NetFramework.g.cs | 8 ++++++-- .../Quantities/PowerDensity.NetFramework.g.cs | 8 ++++++-- .../Quantities/PowerRatio.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/Pressure.NetFramework.g.cs | 8 ++++++-- .../Quantities/PressureChangeRate.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/Ratio.NetFramework.g.cs | 8 ++++++-- .../Quantities/ReactiveEnergy.NetFramework.g.cs | 8 ++++++-- .../Quantities/ReactivePower.NetFramework.g.cs | 8 ++++++-- .../Quantities/RotationalAcceleration.NetFramework.g.cs | 8 ++++++-- .../Quantities/RotationalSpeed.NetFramework.g.cs | 8 ++++++-- .../Quantities/RotationalStiffness.NetFramework.g.cs | 8 ++++++-- .../RotationalStiffnessPerLength.NetFramework.g.cs | 8 ++++++-- .../Quantities/SolidAngle.NetFramework.g.cs | 8 ++++++-- .../Quantities/SpecificEnergy.NetFramework.g.cs | 8 ++++++-- .../Quantities/SpecificEntropy.NetFramework.g.cs | 8 ++++++-- .../Quantities/SpecificVolume.NetFramework.g.cs | 8 ++++++-- .../Quantities/SpecificWeight.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/Speed.NetFramework.g.cs | 8 ++++++-- .../Quantities/Temperature.NetFramework.g.cs | 8 ++++++-- .../Quantities/TemperatureChangeRate.NetFramework.g.cs | 8 ++++++-- .../Quantities/TemperatureDelta.NetFramework.g.cs | 8 ++++++-- .../Quantities/ThermalConductivity.NetFramework.g.cs | 8 ++++++-- .../Quantities/ThermalResistance.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/Torque.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/VitaminA.NetFramework.g.cs | 8 ++++++-- .../GeneratedCode/Quantities/Volume.NetFramework.g.cs | 8 ++++++-- .../Quantities/VolumeFlow.NetFramework.g.cs | 8 ++++++-- .../Include-GenerateQuantitySourceCodeNetFramework.ps1 | 8 ++++++-- 182 files changed, 1094 insertions(+), 363 deletions(-) diff --git a/UnitsNet.Tests/QuantityIConvertibleTests.cs b/UnitsNet.Tests/QuantityIConvertibleTests.cs index 24a6326c5a..e9ec133655 100644 --- a/UnitsNet.Tests/QuantityIConvertibleTests.cs +++ b/UnitsNet.Tests/QuantityIConvertibleTests.cs @@ -136,10 +136,17 @@ public void ToTypeTest() Assert.Throws(() => lengthAsIConvertible.ToType(typeof(Duration), null)); Assert.Throws(() => Convert.ChangeType(length, typeof(Duration))); - // Different unit type Assert.Throws(() => lengthAsIConvertible.ToType(typeof(DurationUnit), null)); Assert.Throws(() => Convert.ChangeType(length, typeof(DurationUnit))); + + // QuantityType + Assert.Equal(Length.QuantityType, lengthAsIConvertible.ToType(typeof(QuantityType), null)); + Assert.Equal(Length.QuantityType, Convert.ChangeType(length, typeof(QuantityType))); + + // BaseDimensions + Assert.Equal(Length.BaseDimensions, lengthAsIConvertible.ToType(typeof(BaseDimensions), null)); + Assert.Equal(Length.BaseDimensions, Convert.ChangeType(length, typeof(BaseDimensions))); } [Fact] diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs index 7492686b68..2b704edf20 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs @@ -860,8 +860,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(AccelerationUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Acceleration)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Acceleration.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Acceleration.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Acceleration)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs index abca1b2906..0db8ab9ab5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs @@ -894,8 +894,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(AmountOfSubstanceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return AmountOfSubstance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return AmountOfSubstance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs index 07a9861d4c..227bab3be3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs @@ -707,8 +707,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(AmplitudeRatioUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return AmplitudeRatio.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return AmplitudeRatio.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs index df4702c3dd..f632142145 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs @@ -877,8 +877,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(AngleUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Angle)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Angle.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Angle.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Angle)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs index 196e0dd21a..5ee53b4938 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs @@ -690,8 +690,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ApparentEnergyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ApparentEnergy.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ApparentEnergy.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs index 9986eef74b..3c2af35aa1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs @@ -707,8 +707,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ApparentPowerUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ApparentPower)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ApparentPower.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ApparentPower.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ApparentPower)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs index 6560a2b0e8..7c5541ea7f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs @@ -860,8 +860,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(AreaUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Area)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Area.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Area.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Area)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs index 8c5e37a6a9..f5c4a92a3d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs @@ -656,8 +656,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(AreaDensityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(AreaDensity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return AreaDensity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return AreaDensity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(AreaDensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs index 5ffb936380..8fbb07f106 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -741,8 +741,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(AreaMomentOfInertiaUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return AreaMomentOfInertia.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return AreaMomentOfInertia.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs index c5ef616220..a81a367fde 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs @@ -1084,8 +1084,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(BitRateUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(BitRate)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return BitRate.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return BitRate.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(BitRate)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs index a763c7ed1d..2f90eac97e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs @@ -690,8 +690,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(BrakeSpecificFuelConsumptionUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return BrakeSpecificFuelConsumption.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return BrakeSpecificFuelConsumption.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs index 78f12393ab..c47bf62132 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs @@ -761,8 +761,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(CapacitanceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Capacitance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Capacitance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Capacitance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Capacitance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs index 0df7ef9ac2..35a191f61c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs @@ -690,8 +690,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(CoefficientOfThermalExpansionUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return CoefficientOfThermalExpansion.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return CoefficientOfThermalExpansion.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs index cea7e4ba28..9d030ae7d6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs @@ -1305,8 +1305,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(DensityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Density)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Density.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Density.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Density)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs index 256b60cbf9..4f62557dee 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs @@ -809,8 +809,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(DurationUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Duration)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Duration.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Duration.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Duration)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs index d9ebcd5b1a..f42ec764f9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs @@ -744,8 +744,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(DynamicViscosityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return DynamicViscosity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return DynamicViscosity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs index 432f9a6b47..787faba0e5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs @@ -707,8 +707,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricAdmittanceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricAdmittance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricAdmittance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs index 4b8e88c42f..452fe7082d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs @@ -659,8 +659,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricChargeUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricCharge.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricCharge.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs index 06f51d75fd..275266d249 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs @@ -659,8 +659,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricChargeDensityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricChargeDensity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricChargeDensity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs index 1d58ee9ad7..65842ff9b3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs @@ -693,8 +693,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricConductanceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricConductance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricConductance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs index 52ed2e0dc7..169b2a147d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs @@ -659,8 +659,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricConductivityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricConductivity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricConductivity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs index 3e836df925..619f1c42f1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs @@ -775,8 +775,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricCurrentUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricCurrent.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricCurrent.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs index 5df901a009..d1e630edb2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs @@ -659,8 +659,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricCurrentDensityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricCurrentDensity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricCurrentDensity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs index 4d14557f2c..6467eec9ff 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs @@ -656,8 +656,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricCurrentGradientUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricCurrentGradient.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricCurrentGradient.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs index c821709565..a4f222c3de 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs @@ -659,8 +659,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricFieldUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricField)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricField.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricField.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricField)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs index ab7e7ad0d4..783176ae48 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs @@ -710,8 +710,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricInductanceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricInductance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricInductance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs index 6a2f3bf719..7579ee1514 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs @@ -724,8 +724,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricPotentialUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricPotential.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricPotential.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs index 9a0eb5257b..6c70532fc5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs @@ -724,8 +724,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricPotentialAcUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricPotentialAc.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricPotentialAc.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs index 1fb8a2b693..f34f6dac06 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs @@ -724,8 +724,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricPotentialDcUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricPotentialDc.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricPotentialDc.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs index db63ffc2d3..649a7cb915 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs @@ -724,8 +724,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricResistanceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricResistance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricResistance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs index 3c67e2a80a..8dc0b76c60 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs @@ -880,8 +880,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricResistivityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricResistivity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricResistivity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs index e6318d881e..77794075ea 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs @@ -1013,8 +1013,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(EnergyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Energy)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Energy.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Energy.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Energy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs index 6384982d18..4f972bc3f6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs @@ -758,8 +758,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(EntropyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Entropy)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Entropy.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Entropy.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Entropy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs index c60a539278..ee53aef22a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs @@ -860,8 +860,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ForceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Force)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Force.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Force.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Force)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs index c44992c404..23a213eda5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs @@ -826,8 +826,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ForceChangeRateUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ForceChangeRate.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ForceChangeRate.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs index be04373380..5fba352c99 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs @@ -792,8 +792,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ForcePerLengthUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ForcePerLength.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ForcePerLength.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs index 20e871a7c7..56509e71b5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs @@ -775,8 +775,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(FrequencyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Frequency)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Frequency.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Frequency.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Frequency)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs index b94fe339ad..101baa6fad 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs @@ -945,8 +945,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(HeatFluxUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(HeatFlux)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return HeatFlux.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return HeatFlux.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(HeatFlux)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs index 480ba7bc2e..ba8cfd1799 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs @@ -673,8 +673,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(HeatTransferCoefficientUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return HeatTransferCoefficient.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return HeatTransferCoefficient.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs index 1380fda70d..260d270f29 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs @@ -710,8 +710,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(IlluminanceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Illuminance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Illuminance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Illuminance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Illuminance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs index c54c532613..052e0e1d8b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs @@ -1081,8 +1081,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(InformationUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Information)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Information.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Information.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Information)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs index c8a59edc2f..6632bd8cbf 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs @@ -877,8 +877,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(IrradianceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Irradiance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Irradiance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Irradiance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Irradiance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs index aa77d64a18..b478149b77 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs @@ -710,8 +710,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(IrradiationUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Irradiation)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Irradiation.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Irradiation.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Irradiation)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs index 859f2a094c..6e2ee2bb9d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs @@ -778,8 +778,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(KinematicViscosityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return KinematicViscosity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return KinematicViscosity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs index d00feb833f..1123fd3f70 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs @@ -656,8 +656,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(LapseRateUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(LapseRate)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return LapseRate.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return LapseRate.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(LapseRate)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs index 5c3dfa87c2..0ff2a3d638 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs @@ -1013,8 +1013,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(LengthUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Length)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Length.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Length.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Length)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs index abf428750a..51435aa1f8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs @@ -673,8 +673,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(LevelUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Level)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Level.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Level.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Level)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs index 1b2ace3df8..7a0121d71f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs @@ -693,8 +693,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(LinearDensityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(LinearDensity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return LinearDensity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return LinearDensity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(LinearDensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs index 53ba7188cd..04efcb6d5c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs @@ -659,8 +659,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(LuminousFluxUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return LuminousFlux.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return LuminousFlux.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs index e74aaafea4..db54e2c316 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs @@ -659,8 +659,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(LuminousIntensityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return LuminousIntensity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return LuminousIntensity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs index ae6cb6a83a..cd0b47effd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs @@ -710,8 +710,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MagneticFieldUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(MagneticField)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return MagneticField.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return MagneticField.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(MagneticField)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs index 99b801ac2d..dbc4bcc096 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs @@ -659,8 +659,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MagneticFluxUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return MagneticFlux.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return MagneticFlux.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs index 0a9534fb3e..d0251a6402 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs @@ -659,8 +659,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MagnetizationUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Magnetization)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Magnetization.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Magnetization.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Magnetization)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs index 795bec08c6..7639f90b7f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs @@ -1030,8 +1030,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MassUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Mass)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Mass.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Mass.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Mass)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs index 50e8c2c886..c2fb538a64 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs @@ -1166,8 +1166,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MassFlowUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(MassFlow)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return MassFlow.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return MassFlow.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(MassFlow)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs index c75fa82568..2d035c7d6c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs @@ -673,8 +673,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MassFluxUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(MassFlux)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return MassFlux.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return MassFlux.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(MassFlux)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs index 2f5e8322f3..96695a5149 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -1115,8 +1115,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MassMomentOfInertiaUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return MassMomentOfInertia.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return MassMomentOfInertia.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs index 37bdff50ef..f623018270 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs @@ -690,8 +690,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MolarEnergyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return MolarEnergy.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return MolarEnergy.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs index 2042b3cfa5..1df1bb5c0a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs @@ -690,8 +690,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MolarEntropyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return MolarEntropy.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return MolarEntropy.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs index cb143da476..1559d6f6fd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs @@ -843,8 +843,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MolarMassUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(MolarMass)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return MolarMass.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return MolarMass.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(MolarMass)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs index c02b7e5b64..9f0ff45527 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs @@ -778,8 +778,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MolarityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Molarity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Molarity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Molarity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Molarity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs index cbb0f13a9e..2d4b6f7a15 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs @@ -659,8 +659,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(PermeabilityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Permeability)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Permeability.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Permeability.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Permeability)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs index 7869742145..becca311af 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs @@ -659,8 +659,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(PermittivityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Permittivity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Permittivity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Permittivity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Permittivity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs index 276dd3cbbd..7b8ee5f119 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs @@ -979,8 +979,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(PowerUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Power)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Power.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Power.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Power)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs index b61c15c8f7..aa64a812a9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs @@ -1387,8 +1387,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(PowerDensityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(PowerDensity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return PowerDensity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return PowerDensity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(PowerDensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs index 9726ec845f..5b3cc5f493 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs @@ -673,8 +673,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(PowerRatioUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(PowerRatio)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return PowerRatio.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return PowerRatio.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(PowerRatio)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs index 14cb98381a..8f7c36d09a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs @@ -1353,8 +1353,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(PressureUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Pressure)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Pressure.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Pressure.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Pressure)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs index f1ca83e8fd..bb0ebec6ff 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs @@ -758,8 +758,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(PressureChangeRateUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return PressureChangeRate.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return PressureChangeRate.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs index 83fec84776..51e67e1160 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs @@ -741,8 +741,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(RatioUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Ratio)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Ratio.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Ratio.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Ratio)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs index 7b46adfee2..66c0cdc438 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs @@ -690,8 +690,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ReactiveEnergyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ReactiveEnergy.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ReactiveEnergy.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs index d07cf83aef..0cb836544b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs @@ -707,8 +707,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ReactivePowerUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ReactivePower)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ReactivePower.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ReactivePower.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ReactivePower)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs index 635d682e37..6fdb7780a2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs @@ -690,8 +690,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(RotationalAccelerationUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return RotationalAcceleration.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return RotationalAcceleration.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs index c1a06101c8..385adde8f4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs @@ -860,8 +860,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(RotationalSpeedUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return RotationalSpeed.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return RotationalSpeed.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs index f73d42da16..cad206a2fa 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs @@ -690,8 +690,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(RotationalStiffnessUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return RotationalStiffness.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return RotationalStiffness.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs index 4b2709fcfa..aa6a804d43 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs @@ -690,8 +690,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(RotationalStiffnessPerLengthUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return RotationalStiffnessPerLength.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return RotationalStiffnessPerLength.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs index 250a3b075f..cb8851c605 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs @@ -659,8 +659,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(SolidAngleUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(SolidAngle)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return SolidAngle.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return SolidAngle.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(SolidAngle)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs index e358911be5..15e75d5421 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs @@ -795,8 +795,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(SpecificEnergyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return SpecificEnergy.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return SpecificEnergy.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs index cda08bef8b..4e1e01b9dc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs @@ -775,8 +775,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(SpecificEntropyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return SpecificEntropy.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return SpecificEntropy.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs index ab93568173..a1ba0f9c43 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs @@ -690,8 +690,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(SpecificVolumeUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return SpecificVolume.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return SpecificVolume.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs index 98b95d8ffb..b1c0bcd696 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs @@ -931,8 +931,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(SpecificWeightUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return SpecificWeight.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return SpecificWeight.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs index 0b3d674972..f32ee64fe8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs @@ -1183,8 +1183,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(SpeedUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Speed)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Speed.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Speed.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Speed)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs index 17ea458de1..63673658e9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs @@ -775,8 +775,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(TemperatureUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Temperature)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Temperature.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Temperature.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Temperature)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs index 96514d2f7b..527cbea74e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs @@ -809,8 +809,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(TemperatureChangeRateUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return TemperatureChangeRate.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return TemperatureChangeRate.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs index 82e0ff13a5..e63e37e170 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs @@ -775,8 +775,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(TemperatureDeltaUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return TemperatureDelta.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return TemperatureDelta.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs index 47a2c0af57..12b79f8301 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs @@ -676,8 +676,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ThermalConductivityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ThermalConductivity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ThermalConductivity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs index fe1d9a6ce9..e45f4486f1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs @@ -724,8 +724,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ThermalResistanceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ThermalResistance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ThermalResistance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs index b456c5d5bf..461b3fb943 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs @@ -996,8 +996,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(TorqueUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Torque)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Torque.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Torque.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Torque)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs index c035576365..3d187554de 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs @@ -656,8 +656,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(VitaminAUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(VitaminA)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return VitaminA.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return VitaminA.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(VitaminA)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs index be2d9d4f21..8eff741a45 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs @@ -1404,8 +1404,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(VolumeUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Volume)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Volume.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Volume.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Volume)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs index 72388405db..4a04384d95 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs @@ -1455,8 +1455,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(VolumeFlowUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return VolumeFlow.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return VolumeFlow.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index 0894adbc77..b76a543a03 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -886,8 +886,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(AccelerationUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Acceleration)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Acceleration.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Acceleration.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Acceleration)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index 00eac0d250..f516e239a2 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -918,8 +918,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(AmountOfSubstanceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return AmountOfSubstance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return AmountOfSubstance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs index e7bc5e677e..efb331d2d7 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -750,8 +750,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(AmplitudeRatioUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return AmplitudeRatio.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return AmplitudeRatio.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index 13f5a9497a..cc0255abd7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -902,8 +902,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(AngleUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Angle)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Angle.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Angle.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Angle)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index 6130bcd0c6..c19f082762 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -726,8 +726,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ApparentEnergyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ApparentEnergy.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ApparentEnergy.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index 0033f90201..50d0e0befc 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -742,8 +742,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ApparentPowerUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ApparentPower)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ApparentPower.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ApparentPower.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ApparentPower)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index bcd536a8fa..7363b651bb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -886,8 +886,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(AreaUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Area)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Area.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Area.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Area)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index 9235ae80ca..d0884507d1 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -694,8 +694,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(AreaDensityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(AreaDensity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return AreaDensity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return AreaDensity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(AreaDensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index e5558eff6b..5f776ee2cd 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -774,8 +774,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(AreaMomentOfInertiaUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return AreaMomentOfInertia.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return AreaMomentOfInertia.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs index 4d89af749d..d2e10eca7e 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -1097,8 +1097,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(BitRateUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(BitRate)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return BitRate.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return BitRate.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(BitRate)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index 4ecaa2809d..4f4160ae76 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -726,8 +726,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(BrakeSpecificFuelConsumptionUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return BrakeSpecificFuelConsumption.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return BrakeSpecificFuelConsumption.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs index aa02f62881..5771a011a8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -793,8 +793,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(CapacitanceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Capacitance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Capacitance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Capacitance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Capacitance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs index f23d40531f..853fd9d1eb 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs @@ -726,8 +726,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(CoefficientOfThermalExpansionUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return CoefficientOfThermalExpansion.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return CoefficientOfThermalExpansion.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index ec06d82986..a2969bde7d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -1305,8 +1305,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(DensityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Density)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Density.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Density.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Density)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index 34d7bc340e..c22ef2eca4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -838,8 +838,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(DurationUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Duration)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Duration.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Duration.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Duration)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index f938f5f963..075f58d199 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -777,8 +777,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(DynamicViscosityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return DynamicViscosity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return DynamicViscosity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs index 2917fd0db7..200f5dac38 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -742,8 +742,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricAdmittanceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricAdmittance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricAdmittance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs index da91c054d5..8105685bd0 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -697,8 +697,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricChargeUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricCharge.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricCharge.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index 224df0f3a4..2b85a04995 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -697,8 +697,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricChargeDensityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricChargeDensity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricChargeDensity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs index 7e9ec30260..670ed02459 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -729,8 +729,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricConductanceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricConductance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricConductance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs index 85d4134494..3a957e37a8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -697,8 +697,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricConductivityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricConductivity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricConductivity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs index 123b420ce4..e1150f1b90 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -806,8 +806,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricCurrentUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricCurrent.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricCurrent.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs index becbef2079..d572188012 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -697,8 +697,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricCurrentDensityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricCurrentDensity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricCurrentDensity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs index af9d802481..14fb9e8615 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -694,8 +694,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricCurrentGradientUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricCurrentGradient.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricCurrentGradient.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs index 48cbf1fdf6..64a3f6ed40 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -697,8 +697,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricFieldUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricField)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricField.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricField.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricField)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index 8b5c081d7a..7b0d0fb62f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -745,8 +745,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricInductanceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricInductance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricInductance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs index e9907db8ae..ad3ed57f14 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -758,8 +758,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricPotentialUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricPotential.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricPotential.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs index 7900d3a4cc..fc0618d461 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -758,8 +758,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricPotentialAcUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricPotentialAc.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricPotentialAc.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs index 8158f22cc3..d24be17df2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -758,8 +758,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricPotentialDcUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricPotentialDc.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricPotentialDc.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs index 1aee8ef8eb..827f959be7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -758,8 +758,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricResistanceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricResistance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricResistance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs index e61dccae25..2516c81fc4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -905,8 +905,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ElectricResistivityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ElectricResistivity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ElectricResistivity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs index 38c4fa0423..ae72a83b36 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -1030,8 +1030,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(EnergyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Energy)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Energy.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Energy.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Energy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index 233c94b939..4cd7af793c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -790,8 +790,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(EntropyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Entropy)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Entropy.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Entropy.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Entropy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index 59d22fce3a..562994021c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -886,8 +886,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ForceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Force)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Force.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Force.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Force)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index 8f43869b36..07760c84c7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -854,8 +854,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ForceChangeRateUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ForceChangeRate.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ForceChangeRate.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs index 6cb0f3ea96..1258e26772 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -822,8 +822,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ForcePerLengthUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ForcePerLength.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ForcePerLength.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index f5e9e8756a..c5a7000cb6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -806,8 +806,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(FrequencyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Frequency)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Frequency.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Frequency.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Frequency)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index f549a58a4d..0e9713b059 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -966,8 +966,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(HeatFluxUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(HeatFlux)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return HeatFlux.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return HeatFlux.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(HeatFlux)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index d1b0d0f59e..4a864f41df 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -710,8 +710,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(HeatTransferCoefficientUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return HeatTransferCoefficient.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return HeatTransferCoefficient.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs index 459ebbc178..7f2de54587 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -745,8 +745,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(IlluminanceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Illuminance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Illuminance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Illuminance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Illuminance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index 6a70cfabb3..802ed21858 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -1094,8 +1094,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(InformationUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Information)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Information.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Information.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Information)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index a33c54eaf9..e3ab8ef200 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -902,8 +902,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(IrradianceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Irradiance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Irradiance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Irradiance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Irradiance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index 8f4c410384..2b21fc1554 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -745,8 +745,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(IrradiationUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Irradiation)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Irradiation.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Irradiation.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Irradiation)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index d597c8c20e..fd7f0f1f74 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -809,8 +809,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(KinematicViscosityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return KinematicViscosity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return KinematicViscosity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs index 40799c1995..f07b79084b 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -694,8 +694,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(LapseRateUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(LapseRate)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return LapseRate.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return LapseRate.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(LapseRate)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index 232a2819a7..15da38520a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -1030,8 +1030,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(LengthUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Length)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Length.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Length.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Length)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index 6a3f119d39..0dee544d7f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -718,8 +718,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(LevelUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Level)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Level.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Level.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Level)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index 6bd65fe7b4..37e29fc7f2 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -729,8 +729,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(LinearDensityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(LinearDensity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return LinearDensity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return LinearDensity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(LinearDensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index 1a2c4f8caa..3e812be1af 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -697,8 +697,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(LuminousFluxUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return LuminousFlux.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return LuminousFlux.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index e083023e5f..327776db34 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -697,8 +697,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(LuminousIntensityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return LuminousIntensity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return LuminousIntensity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs index ae4343f863..407e874fd1 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -745,8 +745,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MagneticFieldUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(MagneticField)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return MagneticField.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return MagneticField.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(MagneticField)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index aa4e0dd883..2cc4076c52 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -697,8 +697,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MagneticFluxUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return MagneticFlux.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return MagneticFlux.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index 3b0eedd136..7e10ce5ad1 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -697,8 +697,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MagnetizationUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Magnetization)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Magnetization.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Magnetization.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Magnetization)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index 51979b02be..9536d36dfc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -1046,8 +1046,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MassUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Mass)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Mass.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Mass.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Mass)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index 1863787ef7..ab4492fd1a 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -1174,8 +1174,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MassFlowUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(MassFlow)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return MassFlow.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return MassFlow.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(MassFlow)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index 0ec968a514..cb725eabbc 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -710,8 +710,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MassFluxUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(MassFlux)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return MassFlux.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return MassFlux.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(MassFlux)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index 108e96a1c8..f6e3f97bed 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -1126,8 +1126,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MassMomentOfInertiaUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return MassMomentOfInertia.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return MassMomentOfInertia.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs index b90932ff4e..fa0c72c2e4 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -726,8 +726,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MolarEnergyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return MolarEnergy.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return MolarEnergy.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index f42a12dd75..8be7b13240 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -726,8 +726,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MolarEntropyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return MolarEntropy.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return MolarEntropy.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index 2de5ea05b2..fbca1d411c 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -870,8 +870,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MolarMassUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(MolarMass)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return MolarMass.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return MolarMass.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(MolarMass)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index 2e71b83003..ec36aa3df4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -809,8 +809,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(MolarityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Molarity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Molarity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Molarity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Molarity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index d3f59f79d9..452ec68dca 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -697,8 +697,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(PermeabilityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Permeability)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Permeability.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Permeability.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Permeability)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index d50bae7dd5..79ad599c06 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -697,8 +697,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(PermittivityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Permittivity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Permittivity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Permittivity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Permittivity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index d9eaa32d05..eb457cde5a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -998,8 +998,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(PowerUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Power)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Power.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Power.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Power)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index 91bcd3ba52..e7b776e807 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -1382,8 +1382,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(PowerDensityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(PowerDensity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return PowerDensity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return PowerDensity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(PowerDensity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index 2ccdddc214..54d76abc06 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -718,8 +718,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(PowerRatioUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(PowerRatio)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return PowerRatio.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return PowerRatio.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(PowerRatio)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index fffd37756e..0fe58ab147 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -1350,8 +1350,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(PressureUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Pressure)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Pressure.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Pressure.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Pressure)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index 5008809856..64b4323d45 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -790,8 +790,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(PressureChangeRateUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return PressureChangeRate.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return PressureChangeRate.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs index 37f3d37761..5c98dc8550 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -774,8 +774,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(RatioUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Ratio)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Ratio.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Ratio.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Ratio)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index 90843c6ba1..10d3abe728 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -726,8 +726,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ReactiveEnergyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ReactiveEnergy.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ReactiveEnergy.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index f90ea993f5..f6e3468602 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -742,8 +742,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ReactivePowerUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ReactivePower)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ReactivePower.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ReactivePower.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ReactivePower)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index dce3a12285..41046021fc 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -726,8 +726,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(RotationalAccelerationUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return RotationalAcceleration.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return RotationalAcceleration.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs index 78a671e6b6..5c7a74f0a3 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -886,8 +886,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(RotationalSpeedUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return RotationalSpeed.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return RotationalSpeed.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs index 9225a807bf..f914dbe519 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -726,8 +726,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(RotationalStiffnessUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return RotationalStiffness.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return RotationalStiffness.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs index 529de0b6a2..e1567308bc 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -726,8 +726,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(RotationalStiffnessPerLengthUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return RotationalStiffnessPerLength.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return RotationalStiffnessPerLength.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs index 73fe45b442..42c5409c5b 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -697,8 +697,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(SolidAngleUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(SolidAngle)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return SolidAngle.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return SolidAngle.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(SolidAngle)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index c093257e57..1968dafea5 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -825,8 +825,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(SpecificEnergyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return SpecificEnergy.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return SpecificEnergy.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index 5f7d9ee1d8..e8b73bb3b2 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -806,8 +806,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(SpecificEntropyUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return SpecificEntropy.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return SpecificEntropy.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs index 40da586ea8..039d93a1b8 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -726,8 +726,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(SpecificVolumeUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return SpecificVolume.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return SpecificVolume.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index a319dbf64a..a3591b20cf 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -953,8 +953,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(SpecificWeightUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return SpecificWeight.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return SpecificWeight.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index 811a8e1a35..146dbff39f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -1190,8 +1190,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(SpeedUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Speed)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Speed.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Speed.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Speed)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index 54f2e36f73..d4b3ca961b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -767,8 +767,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(TemperatureUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Temperature)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Temperature.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Temperature.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Temperature)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index 19880cf480..1a76c28814 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -838,8 +838,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(TemperatureChangeRateUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return TemperatureChangeRate.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return TemperatureChangeRate.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index 2851b58f52..4d56d58ca7 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -806,8 +806,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(TemperatureDeltaUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return TemperatureDelta.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return TemperatureDelta.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs index 32d714b4f2..807319557d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -713,8 +713,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ThermalConductivityUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ThermalConductivity.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ThermalConductivity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs index 0a815295c6..12ecc5a30e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -758,8 +758,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(ThermalResistanceUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return ThermalResistance.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return ThermalResistance.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs index a060449e08..799de4ecae 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -1014,8 +1014,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(TorqueUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Torque)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Torque.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Torque.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Torque)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index 07d5e94bb7..562d48cfd6 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -694,8 +694,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(VitaminAUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(VitaminA)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return VitaminA.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return VitaminA.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(VitaminA)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index 120f20c38a..11c8a426e8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -1398,8 +1398,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(VolumeUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(Volume)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return Volume.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return Volume.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(Volume)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index 1be624cb12..2b715dea26 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -1446,8 +1446,12 @@ object IConvertible.ToType(Type conversionType, IFormatProvider provider) return this; else if(conversionType == typeof(VolumeFlowUnit)) return Unit; - - throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return VolumeFlow.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return VolumeFlow.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index 8fa0b2c951..8ea9502b37 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -331,8 +331,12 @@ if ($obsoleteAttribute) return this; else if(conversionType == typeof($unitEnumName)) return Unit; - - throw new InvalidCastException($"Converting {typeof($quantityName)} to {conversionType} is not supported."); + else if(conversionType == typeof(QuantityType)) + return $quantityName.QuantityType; + else if(conversionType == typeof(BaseDimensions)) + return $quantityName.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof($quantityName)} to {conversionType} is not supported."); } ushort IConvertible.ToUInt16(IFormatProvider provider) From 88f9055a2d1ca8c374ba36416db28b4901509ad5 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 1 Feb 2019 11:23:08 -0500 Subject: [PATCH 3/3] Skip IConvertible code for WRC --- .../Acceleration.WindowsRuntimeComponent.g.cs | 101 ------------------ ...ntOfSubstance.WindowsRuntimeComponent.g.cs | 101 ------------------ ...mplitudeRatio.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Angle.WindowsRuntimeComponent.g.cs | 101 ------------------ ...pparentEnergy.WindowsRuntimeComponent.g.cs | 101 ------------------ ...ApparentPower.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Area.WindowsRuntimeComponent.g.cs | 101 ------------------ .../AreaDensity.WindowsRuntimeComponent.g.cs | 101 ------------------ ...mentOfInertia.WindowsRuntimeComponent.g.cs | 101 ------------------ .../BitRate.WindowsRuntimeComponent.g.cs | 101 ------------------ ...elConsumption.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Capacitance.WindowsRuntimeComponent.g.cs | 101 ------------------ ...rmalExpansion.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Density.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Duration.WindowsRuntimeComponent.g.cs | 101 ------------------ ...amicViscosity.WindowsRuntimeComponent.g.cs | 101 ------------------ ...ricAdmittance.WindowsRuntimeComponent.g.cs | 101 ------------------ ...lectricCharge.WindowsRuntimeComponent.g.cs | 101 ------------------ ...ChargeDensity.WindowsRuntimeComponent.g.cs | 101 ------------------ ...icConductance.WindowsRuntimeComponent.g.cs | 101 ------------------ ...cConductivity.WindowsRuntimeComponent.g.cs | 101 ------------------ ...ectricCurrent.WindowsRuntimeComponent.g.cs | 101 ------------------ ...urrentDensity.WindowsRuntimeComponent.g.cs | 101 ------------------ ...rrentGradient.WindowsRuntimeComponent.g.cs | 101 ------------------ ...ElectricField.WindowsRuntimeComponent.g.cs | 101 ------------------ ...ricInductance.WindowsRuntimeComponent.g.cs | 101 ------------------ ...tricPotential.WindowsRuntimeComponent.g.cs | 101 ------------------ ...icPotentialAc.WindowsRuntimeComponent.g.cs | 101 ------------------ ...icPotentialDc.WindowsRuntimeComponent.g.cs | 101 ------------------ ...ricResistance.WindowsRuntimeComponent.g.cs | 101 ------------------ ...icResistivity.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Energy.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Entropy.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Force.WindowsRuntimeComponent.g.cs | 101 ------------------ ...rceChangeRate.WindowsRuntimeComponent.g.cs | 101 ------------------ ...orcePerLength.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Frequency.WindowsRuntimeComponent.g.cs | 101 ------------------ .../HeatFlux.WindowsRuntimeComponent.g.cs | 101 ------------------ ...erCoefficient.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Illuminance.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Information.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Irradiance.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Irradiation.WindowsRuntimeComponent.g.cs | 101 ------------------ ...aticViscosity.WindowsRuntimeComponent.g.cs | 101 ------------------ .../LapseRate.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Length.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Level.WindowsRuntimeComponent.g.cs | 101 ------------------ ...LinearDensity.WindowsRuntimeComponent.g.cs | 101 ------------------ .../LuminousFlux.WindowsRuntimeComponent.g.cs | 101 ------------------ ...nousIntensity.WindowsRuntimeComponent.g.cs | 101 ------------------ ...MagneticField.WindowsRuntimeComponent.g.cs | 101 ------------------ .../MagneticFlux.WindowsRuntimeComponent.g.cs | 101 ------------------ ...Magnetization.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Mass.WindowsRuntimeComponent.g.cs | 101 ------------------ .../MassFlow.WindowsRuntimeComponent.g.cs | 101 ------------------ .../MassFlux.WindowsRuntimeComponent.g.cs | 101 ------------------ ...mentOfInertia.WindowsRuntimeComponent.g.cs | 101 ------------------ .../MolarEnergy.WindowsRuntimeComponent.g.cs | 101 ------------------ .../MolarEntropy.WindowsRuntimeComponent.g.cs | 101 ------------------ .../MolarMass.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Molarity.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Permeability.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Permittivity.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Power.WindowsRuntimeComponent.g.cs | 101 ------------------ .../PowerDensity.WindowsRuntimeComponent.g.cs | 101 ------------------ .../PowerRatio.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Pressure.WindowsRuntimeComponent.g.cs | 101 ------------------ ...ureChangeRate.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Ratio.WindowsRuntimeComponent.g.cs | 101 ------------------ ...eactiveEnergy.WindowsRuntimeComponent.g.cs | 101 ------------------ ...ReactivePower.WindowsRuntimeComponent.g.cs | 101 ------------------ ...lAcceleration.WindowsRuntimeComponent.g.cs | 101 ------------------ ...tationalSpeed.WindowsRuntimeComponent.g.cs | 101 ------------------ ...onalStiffness.WindowsRuntimeComponent.g.cs | 101 ------------------ ...nessPerLength.WindowsRuntimeComponent.g.cs | 101 ------------------ .../SolidAngle.WindowsRuntimeComponent.g.cs | 101 ------------------ ...pecificEnergy.WindowsRuntimeComponent.g.cs | 101 ------------------ ...ecificEntropy.WindowsRuntimeComponent.g.cs | 101 ------------------ ...pecificVolume.WindowsRuntimeComponent.g.cs | 101 ------------------ ...pecificWeight.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Speed.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Temperature.WindowsRuntimeComponent.g.cs | 101 ------------------ ...ureChangeRate.WindowsRuntimeComponent.g.cs | 101 ------------------ ...peratureDelta.WindowsRuntimeComponent.g.cs | 101 ------------------ ...lConductivity.WindowsRuntimeComponent.g.cs | 101 ------------------ ...malResistance.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Torque.WindowsRuntimeComponent.g.cs | 101 ------------------ .../VitaminA.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Volume.WindowsRuntimeComponent.g.cs | 101 ------------------ .../VolumeFlow.WindowsRuntimeComponent.g.cs | 101 ------------------ .../Quantities/Acceleration.NetFramework.g.cs | 4 - .../AmountOfSubstance.NetFramework.g.cs | 4 - .../AmplitudeRatio.NetFramework.g.cs | 4 - .../Quantities/Angle.NetFramework.g.cs | 4 - .../ApparentEnergy.NetFramework.g.cs | 4 - .../ApparentPower.NetFramework.g.cs | 4 - .../Quantities/Area.NetFramework.g.cs | 4 - .../Quantities/AreaDensity.NetFramework.g.cs | 4 - .../AreaMomentOfInertia.NetFramework.g.cs | 4 - .../Quantities/BitRate.NetFramework.g.cs | 4 - ...eSpecificFuelConsumption.NetFramework.g.cs | 4 - .../Quantities/Capacitance.NetFramework.g.cs | 4 - ...icientOfThermalExpansion.NetFramework.g.cs | 4 - .../Quantities/Density.NetFramework.g.cs | 4 - .../Quantities/Duration.NetFramework.g.cs | 4 - .../DynamicViscosity.NetFramework.g.cs | 4 - .../ElectricAdmittance.NetFramework.g.cs | 4 - .../ElectricCharge.NetFramework.g.cs | 4 - .../ElectricChargeDensity.NetFramework.g.cs | 4 - .../ElectricConductance.NetFramework.g.cs | 4 - .../ElectricConductivity.NetFramework.g.cs | 4 - .../ElectricCurrent.NetFramework.g.cs | 4 - .../ElectricCurrentDensity.NetFramework.g.cs | 4 - .../ElectricCurrentGradient.NetFramework.g.cs | 4 - .../ElectricField.NetFramework.g.cs | 4 - .../ElectricInductance.NetFramework.g.cs | 4 - .../ElectricPotential.NetFramework.g.cs | 4 - .../ElectricPotentialAc.NetFramework.g.cs | 4 - .../ElectricPotentialDc.NetFramework.g.cs | 4 - .../ElectricResistance.NetFramework.g.cs | 4 - .../ElectricResistivity.NetFramework.g.cs | 4 - .../Quantities/Energy.NetFramework.g.cs | 4 - .../Quantities/Entropy.NetFramework.g.cs | 4 - .../Quantities/Force.NetFramework.g.cs | 4 - .../ForceChangeRate.NetFramework.g.cs | 4 - .../ForcePerLength.NetFramework.g.cs | 4 - .../Quantities/Frequency.NetFramework.g.cs | 4 - .../Quantities/HeatFlux.NetFramework.g.cs | 4 - .../HeatTransferCoefficient.NetFramework.g.cs | 4 - .../Quantities/Illuminance.NetFramework.g.cs | 4 - .../Quantities/Information.NetFramework.g.cs | 4 - .../Quantities/Irradiance.NetFramework.g.cs | 4 - .../Quantities/Irradiation.NetFramework.g.cs | 4 - .../KinematicViscosity.NetFramework.g.cs | 4 - .../Quantities/LapseRate.NetFramework.g.cs | 4 - .../Quantities/Length.NetFramework.g.cs | 4 - .../Quantities/Level.NetFramework.g.cs | 4 - .../LinearDensity.NetFramework.g.cs | 4 - .../Quantities/LuminousFlux.NetFramework.g.cs | 4 - .../LuminousIntensity.NetFramework.g.cs | 4 - .../MagneticField.NetFramework.g.cs | 4 - .../Quantities/MagneticFlux.NetFramework.g.cs | 4 - .../Magnetization.NetFramework.g.cs | 4 - .../Quantities/Mass.NetFramework.g.cs | 4 - .../Quantities/MassFlow.NetFramework.g.cs | 4 - .../Quantities/MassFlux.NetFramework.g.cs | 4 - .../MassMomentOfInertia.NetFramework.g.cs | 4 - .../Quantities/MolarEnergy.NetFramework.g.cs | 4 - .../Quantities/MolarEntropy.NetFramework.g.cs | 4 - .../Quantities/MolarMass.NetFramework.g.cs | 4 - .../Quantities/Molarity.NetFramework.g.cs | 4 - .../Quantities/Permeability.NetFramework.g.cs | 4 - .../Quantities/Permittivity.NetFramework.g.cs | 4 - .../Quantities/Power.NetFramework.g.cs | 4 - .../Quantities/PowerDensity.NetFramework.g.cs | 4 - .../Quantities/PowerRatio.NetFramework.g.cs | 4 - .../Quantities/Pressure.NetFramework.g.cs | 4 - .../PressureChangeRate.NetFramework.g.cs | 4 - .../Quantities/Ratio.NetFramework.g.cs | 4 - .../ReactiveEnergy.NetFramework.g.cs | 4 - .../ReactivePower.NetFramework.g.cs | 4 - .../RotationalAcceleration.NetFramework.g.cs | 4 - .../RotationalSpeed.NetFramework.g.cs | 4 - .../RotationalStiffness.NetFramework.g.cs | 4 - ...tionalStiffnessPerLength.NetFramework.g.cs | 4 - .../Quantities/SolidAngle.NetFramework.g.cs | 4 - .../SpecificEnergy.NetFramework.g.cs | 4 - .../SpecificEntropy.NetFramework.g.cs | 4 - .../SpecificVolume.NetFramework.g.cs | 4 - .../SpecificWeight.NetFramework.g.cs | 4 - .../Quantities/Speed.NetFramework.g.cs | 4 - .../Quantities/Temperature.NetFramework.g.cs | 4 - .../TemperatureChangeRate.NetFramework.g.cs | 4 - .../TemperatureDelta.NetFramework.g.cs | 4 - .../ThermalConductivity.NetFramework.g.cs | 4 - .../ThermalResistance.NetFramework.g.cs | 4 - .../Quantities/Torque.NetFramework.g.cs | 4 - .../Quantities/VitaminA.NetFramework.g.cs | 4 - .../Quantities/Volume.NetFramework.g.cs | 4 - .../Quantities/VolumeFlow.NetFramework.g.cs | 4 - ...GenerateQuantitySourceCodeNetFramework.ps1 | 6 +- 181 files changed, 2 insertions(+), 9454 deletions(-) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs index 2b704edf20..1fb67fc59b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs @@ -785,106 +785,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Acceleration)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Acceleration)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Acceleration)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Acceleration)) - return this; - else if(conversionType == typeof(AccelerationUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Acceleration.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Acceleration.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Acceleration)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs index 0db8ab9ab5..b6b644e541 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs @@ -819,106 +819,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(AmountOfSubstance)) - return this; - else if(conversionType == typeof(AmountOfSubstanceUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return AmountOfSubstance.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return AmountOfSubstance.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(AmountOfSubstance)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs index 227bab3be3..9e02d3f424 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs @@ -632,106 +632,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(AmplitudeRatio)) - return this; - else if(conversionType == typeof(AmplitudeRatioUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return AmplitudeRatio.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return AmplitudeRatio.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(AmplitudeRatio)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs index f632142145..494aa18145 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs @@ -802,106 +802,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Angle)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Angle)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Angle)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Angle)) - return this; - else if(conversionType == typeof(AngleUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Angle.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Angle.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Angle)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs index 5ee53b4938..8f8592c171 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs @@ -615,106 +615,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ApparentEnergy)) - return this; - else if(conversionType == typeof(ApparentEnergyUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ApparentEnergy.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ApparentEnergy.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ApparentEnergy)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs index 3c2af35aa1..8516a1b3e0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs @@ -632,106 +632,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ApparentPower)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ApparentPower)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ApparentPower)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ApparentPower)) - return this; - else if(conversionType == typeof(ApparentPowerUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ApparentPower.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ApparentPower.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ApparentPower)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs index 7c5541ea7f..8f5f82356e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs @@ -785,106 +785,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Area)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Area)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Area)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Area)) - return this; - else if(conversionType == typeof(AreaUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Area.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Area.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Area)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs index f5c4a92a3d..572d77d97c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs @@ -581,106 +581,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(AreaDensity)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(AreaDensity)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(AreaDensity)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(AreaDensity)) - return this; - else if(conversionType == typeof(AreaDensityUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return AreaDensity.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return AreaDensity.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(AreaDensity)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs index 8fbb07f106..a5813a222b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -666,106 +666,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(AreaMomentOfInertia)) - return this; - else if(conversionType == typeof(AreaMomentOfInertiaUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return AreaMomentOfInertia.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return AreaMomentOfInertia.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(AreaMomentOfInertia)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs index a81a367fde..bd3ab787dc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs @@ -1009,106 +1009,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(BitRate)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(BitRate)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(BitRate)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(BitRate)) - return this; - else if(conversionType == typeof(BitRateUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return BitRate.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return BitRate.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(BitRate)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs index 2f90eac97e..8ef5f331e8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs @@ -615,106 +615,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(BrakeSpecificFuelConsumption)) - return this; - else if(conversionType == typeof(BrakeSpecificFuelConsumptionUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return BrakeSpecificFuelConsumption.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return BrakeSpecificFuelConsumption.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(BrakeSpecificFuelConsumption)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs index c47bf62132..721ebdbd9e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs @@ -686,106 +686,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Capacitance)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Capacitance)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Capacitance)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Capacitance)) - return this; - else if(conversionType == typeof(CapacitanceUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Capacitance.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Capacitance.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Capacitance)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs index 35a191f61c..1c39827f58 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs @@ -615,106 +615,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(CoefficientOfThermalExpansion)) - return this; - else if(conversionType == typeof(CoefficientOfThermalExpansionUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return CoefficientOfThermalExpansion.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return CoefficientOfThermalExpansion.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(CoefficientOfThermalExpansion)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs index 9d030ae7d6..8e46361304 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs @@ -1230,106 +1230,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Density)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Density)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Density)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Density)) - return this; - else if(conversionType == typeof(DensityUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Density.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Density.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Density)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs index 4f62557dee..3cdf820820 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs @@ -734,106 +734,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Duration)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Duration)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Duration)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Duration)) - return this; - else if(conversionType == typeof(DurationUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Duration.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Duration.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Duration)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs index f42ec764f9..b0f6057b0c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs @@ -669,106 +669,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(DynamicViscosity)) - return this; - else if(conversionType == typeof(DynamicViscosityUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return DynamicViscosity.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return DynamicViscosity.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(DynamicViscosity)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs index 787faba0e5..1cfdccaa2b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs @@ -632,106 +632,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ElectricAdmittance)) - return this; - else if(conversionType == typeof(ElectricAdmittanceUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ElectricAdmittance.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ElectricAdmittance.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ElectricAdmittance)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs index 452fe7082d..269ad72cc5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs @@ -584,106 +584,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ElectricCharge)) - return this; - else if(conversionType == typeof(ElectricChargeUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ElectricCharge.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ElectricCharge.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ElectricCharge)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs index 275266d249..782537912d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs @@ -584,106 +584,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ElectricChargeDensity)) - return this; - else if(conversionType == typeof(ElectricChargeDensityUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ElectricChargeDensity.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ElectricChargeDensity.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ElectricChargeDensity)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs index 65842ff9b3..e7b2882c57 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs @@ -618,106 +618,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ElectricConductance)) - return this; - else if(conversionType == typeof(ElectricConductanceUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ElectricConductance.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ElectricConductance.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ElectricConductance)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs index 169b2a147d..a95fddd24e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs @@ -584,106 +584,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ElectricConductivity)) - return this; - else if(conversionType == typeof(ElectricConductivityUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ElectricConductivity.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ElectricConductivity.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ElectricConductivity)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs index 619f1c42f1..5bcd60f29c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs @@ -700,106 +700,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ElectricCurrent)) - return this; - else if(conversionType == typeof(ElectricCurrentUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ElectricCurrent.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ElectricCurrent.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ElectricCurrent)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs index d1e630edb2..8ca35fe0bd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs @@ -584,106 +584,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ElectricCurrentDensity)) - return this; - else if(conversionType == typeof(ElectricCurrentDensityUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ElectricCurrentDensity.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ElectricCurrentDensity.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ElectricCurrentDensity)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs index 6467eec9ff..408bcf5593 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs @@ -581,106 +581,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ElectricCurrentGradient)) - return this; - else if(conversionType == typeof(ElectricCurrentGradientUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ElectricCurrentGradient.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ElectricCurrentGradient.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ElectricCurrentGradient)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs index a4f222c3de..1919c92bd1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs @@ -584,106 +584,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricField)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricField)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricField)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ElectricField)) - return this; - else if(conversionType == typeof(ElectricFieldUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ElectricField.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ElectricField.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ElectricField)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs index 783176ae48..57eafc5bac 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs @@ -635,106 +635,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ElectricInductance)) - return this; - else if(conversionType == typeof(ElectricInductanceUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ElectricInductance.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ElectricInductance.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ElectricInductance)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs index 7579ee1514..9cedf847e6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs @@ -649,106 +649,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ElectricPotential)) - return this; - else if(conversionType == typeof(ElectricPotentialUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ElectricPotential.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ElectricPotential.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ElectricPotential)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs index 6c70532fc5..1c568053a8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs @@ -649,106 +649,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ElectricPotentialAc)) - return this; - else if(conversionType == typeof(ElectricPotentialAcUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ElectricPotentialAc.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ElectricPotentialAc.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ElectricPotentialAc)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs index f34f6dac06..54909b5f65 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs @@ -649,106 +649,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ElectricPotentialDc)) - return this; - else if(conversionType == typeof(ElectricPotentialDcUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ElectricPotentialDc.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ElectricPotentialDc.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ElectricPotentialDc)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs index 649a7cb915..bdc4a86256 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs @@ -649,106 +649,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ElectricResistance)) - return this; - else if(conversionType == typeof(ElectricResistanceUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ElectricResistance.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ElectricResistance.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ElectricResistance)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs index 8dc0b76c60..6e20eebff0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs @@ -805,106 +805,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ElectricResistivity)) - return this; - else if(conversionType == typeof(ElectricResistivityUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ElectricResistivity.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ElectricResistivity.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ElectricResistivity)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs index 77794075ea..c18905f3c8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs @@ -938,106 +938,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Energy)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Energy)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Energy)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Energy)) - return this; - else if(conversionType == typeof(EnergyUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Energy.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Energy.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Energy)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs index 4f972bc3f6..d6aa9c8794 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs @@ -683,106 +683,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Entropy)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Entropy)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Entropy)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Entropy)) - return this; - else if(conversionType == typeof(EntropyUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Entropy.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Entropy.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Entropy)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs index ee53aef22a..cb3dd98e27 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs @@ -785,106 +785,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Force)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Force)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Force)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Force)) - return this; - else if(conversionType == typeof(ForceUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Force.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Force.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Force)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs index 23a213eda5..40d504f87d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs @@ -751,106 +751,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ForceChangeRate)) - return this; - else if(conversionType == typeof(ForceChangeRateUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ForceChangeRate.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ForceChangeRate.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ForceChangeRate)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs index 5fba352c99..562d5382fd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs @@ -717,106 +717,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ForcePerLength)) - return this; - else if(conversionType == typeof(ForcePerLengthUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ForcePerLength.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ForcePerLength.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ForcePerLength)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs index 56509e71b5..2e8d71005b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs @@ -700,106 +700,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Frequency)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Frequency)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Frequency)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Frequency)) - return this; - else if(conversionType == typeof(FrequencyUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Frequency.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Frequency.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Frequency)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs index 101baa6fad..ba07259add 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs @@ -870,106 +870,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(HeatFlux)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(HeatFlux)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(HeatFlux)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(HeatFlux)) - return this; - else if(conversionType == typeof(HeatFluxUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return HeatFlux.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return HeatFlux.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(HeatFlux)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs index ba8cfd1799..b12c44de7d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs @@ -598,106 +598,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(HeatTransferCoefficient)) - return this; - else if(conversionType == typeof(HeatTransferCoefficientUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return HeatTransferCoefficient.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return HeatTransferCoefficient.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(HeatTransferCoefficient)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs index 260d270f29..d76b527029 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs @@ -635,106 +635,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Illuminance)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Illuminance)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Illuminance)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Illuminance)) - return this; - else if(conversionType == typeof(IlluminanceUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Illuminance.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Illuminance.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Illuminance)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs index 052e0e1d8b..c754b88f33 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs @@ -1006,106 +1006,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Information)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Information)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Information)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Information)) - return this; - else if(conversionType == typeof(InformationUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Information.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Information.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Information)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs index 6632bd8cbf..c1c11ee8ad 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs @@ -802,106 +802,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Irradiance)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Irradiance)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Irradiance)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Irradiance)) - return this; - else if(conversionType == typeof(IrradianceUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Irradiance.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Irradiance.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Irradiance)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs index b478149b77..eb557d2159 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs @@ -635,106 +635,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Irradiation)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Irradiation)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Irradiation)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Irradiation)) - return this; - else if(conversionType == typeof(IrradiationUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Irradiation.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Irradiation.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Irradiation)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs index 6e2ee2bb9d..c6de1c96b8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs @@ -703,106 +703,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(KinematicViscosity)) - return this; - else if(conversionType == typeof(KinematicViscosityUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return KinematicViscosity.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return KinematicViscosity.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(KinematicViscosity)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs index 1123fd3f70..b90cfbba20 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs @@ -581,106 +581,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(LapseRate)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(LapseRate)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(LapseRate)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(LapseRate)) - return this; - else if(conversionType == typeof(LapseRateUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return LapseRate.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return LapseRate.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(LapseRate)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs index 0ff2a3d638..df3504b613 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs @@ -938,106 +938,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Length)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Length)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Length)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Length)) - return this; - else if(conversionType == typeof(LengthUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Length.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Length.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Length)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs index 51435aa1f8..8056a13111 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs @@ -598,106 +598,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Level)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Level)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Level)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Level)) - return this; - else if(conversionType == typeof(LevelUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Level.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Level.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Level)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs index 7a0121d71f..78c84b8e9d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs @@ -618,106 +618,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(LinearDensity)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(LinearDensity)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(LinearDensity)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(LinearDensity)) - return this; - else if(conversionType == typeof(LinearDensityUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return LinearDensity.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return LinearDensity.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(LinearDensity)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs index 04efcb6d5c..af1d78db80 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs @@ -584,106 +584,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(LuminousFlux)) - return this; - else if(conversionType == typeof(LuminousFluxUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return LuminousFlux.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return LuminousFlux.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(LuminousFlux)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs index db54e2c316..f1501f70fe 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs @@ -584,106 +584,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(LuminousIntensity)) - return this; - else if(conversionType == typeof(LuminousIntensityUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return LuminousIntensity.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return LuminousIntensity.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(LuminousIntensity)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs index cd0b47effd..d4c7aa4895 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs @@ -635,106 +635,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MagneticField)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MagneticField)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MagneticField)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(MagneticField)) - return this; - else if(conversionType == typeof(MagneticFieldUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return MagneticField.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return MagneticField.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(MagneticField)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs index dbc4bcc096..5e10fe04e1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs @@ -584,106 +584,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(MagneticFlux)) - return this; - else if(conversionType == typeof(MagneticFluxUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return MagneticFlux.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return MagneticFlux.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(MagneticFlux)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs index d0251a6402..7ad7020df3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs @@ -584,106 +584,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Magnetization)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Magnetization)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Magnetization)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Magnetization)) - return this; - else if(conversionType == typeof(MagnetizationUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Magnetization.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Magnetization.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Magnetization)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs index 7639f90b7f..16da266233 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs @@ -955,106 +955,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Mass)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Mass)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Mass)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Mass)) - return this; - else if(conversionType == typeof(MassUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Mass.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Mass.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Mass)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs index c2fb538a64..4096d4d687 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs @@ -1091,106 +1091,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MassFlow)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MassFlow)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MassFlow)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(MassFlow)) - return this; - else if(conversionType == typeof(MassFlowUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return MassFlow.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return MassFlow.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(MassFlow)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs index 2d035c7d6c..eaedcfa9e1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs @@ -598,106 +598,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MassFlux)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MassFlux)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MassFlux)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(MassFlux)) - return this; - else if(conversionType == typeof(MassFluxUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return MassFlux.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return MassFlux.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(MassFlux)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs index 96695a5149..2b51a250bf 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -1040,106 +1040,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(MassMomentOfInertia)) - return this; - else if(conversionType == typeof(MassMomentOfInertiaUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return MassMomentOfInertia.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return MassMomentOfInertia.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(MassMomentOfInertia)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs index f623018270..5a95b9d01c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs @@ -615,106 +615,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(MolarEnergy)) - return this; - else if(conversionType == typeof(MolarEnergyUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return MolarEnergy.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return MolarEnergy.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(MolarEnergy)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs index 1df1bb5c0a..af2434cb9d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs @@ -615,106 +615,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(MolarEntropy)) - return this; - else if(conversionType == typeof(MolarEntropyUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return MolarEntropy.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return MolarEntropy.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(MolarEntropy)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs index 1559d6f6fd..20007d4566 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs @@ -768,106 +768,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MolarMass)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MolarMass)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(MolarMass)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(MolarMass)) - return this; - else if(conversionType == typeof(MolarMassUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return MolarMass.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return MolarMass.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(MolarMass)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs index 9f0ff45527..0bc512691f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs @@ -703,106 +703,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Molarity)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Molarity)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Molarity)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Molarity)) - return this; - else if(conversionType == typeof(MolarityUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Molarity.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Molarity.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Molarity)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs index 2d4b6f7a15..00706bcc5b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs @@ -584,106 +584,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Permeability)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Permeability)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Permeability)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Permeability)) - return this; - else if(conversionType == typeof(PermeabilityUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Permeability.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Permeability.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Permeability)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs index becca311af..562075b62e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs @@ -584,106 +584,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Permittivity)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Permittivity)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Permittivity)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Permittivity)) - return this; - else if(conversionType == typeof(PermittivityUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Permittivity.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Permittivity.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Permittivity)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs index 7b8ee5f119..2abba4f715 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs @@ -904,106 +904,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Power)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Power)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Power)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Power)) - return this; - else if(conversionType == typeof(PowerUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Power.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Power.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Power)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs index aa64a812a9..b4592099e8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs @@ -1312,106 +1312,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(PowerDensity)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(PowerDensity)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(PowerDensity)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(PowerDensity)) - return this; - else if(conversionType == typeof(PowerDensityUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return PowerDensity.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return PowerDensity.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(PowerDensity)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs index 5b3cc5f493..ffeec1381c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs @@ -598,106 +598,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(PowerRatio)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(PowerRatio)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(PowerRatio)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(PowerRatio)) - return this; - else if(conversionType == typeof(PowerRatioUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return PowerRatio.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return PowerRatio.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(PowerRatio)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs index 8f7c36d09a..13916183bb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs @@ -1278,106 +1278,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Pressure)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Pressure)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Pressure)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Pressure)) - return this; - else if(conversionType == typeof(PressureUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Pressure.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Pressure.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Pressure)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs index bb0ebec6ff..d87850b632 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs @@ -683,106 +683,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(PressureChangeRate)) - return this; - else if(conversionType == typeof(PressureChangeRateUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return PressureChangeRate.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return PressureChangeRate.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(PressureChangeRate)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs index 51e67e1160..8e65500527 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs @@ -666,106 +666,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Ratio)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Ratio)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Ratio)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Ratio)) - return this; - else if(conversionType == typeof(RatioUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Ratio.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Ratio.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Ratio)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs index 66c0cdc438..d618fdb9de 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs @@ -615,106 +615,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ReactiveEnergy)) - return this; - else if(conversionType == typeof(ReactiveEnergyUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ReactiveEnergy.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ReactiveEnergy.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ReactiveEnergy)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs index 0cb836544b..42da733bcd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs @@ -632,106 +632,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ReactivePower)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ReactivePower)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ReactivePower)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ReactivePower)) - return this; - else if(conversionType == typeof(ReactivePowerUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ReactivePower.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ReactivePower.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ReactivePower)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs index 6fdb7780a2..bbfeef14fd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs @@ -615,106 +615,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(RotationalAcceleration)) - return this; - else if(conversionType == typeof(RotationalAccelerationUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return RotationalAcceleration.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return RotationalAcceleration.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(RotationalAcceleration)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs index 385adde8f4..845586b09f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs @@ -785,106 +785,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(RotationalSpeed)) - return this; - else if(conversionType == typeof(RotationalSpeedUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return RotationalSpeed.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return RotationalSpeed.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(RotationalSpeed)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs index cad206a2fa..53ec27bfe7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs @@ -615,106 +615,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(RotationalStiffness)) - return this; - else if(conversionType == typeof(RotationalStiffnessUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return RotationalStiffness.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return RotationalStiffness.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(RotationalStiffness)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs index aa6a804d43..fa66343fe9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs @@ -615,106 +615,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(RotationalStiffnessPerLength)) - return this; - else if(conversionType == typeof(RotationalStiffnessPerLengthUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return RotationalStiffnessPerLength.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return RotationalStiffnessPerLength.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(RotationalStiffnessPerLength)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs index cb8851c605..cd0a111ce1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs @@ -584,106 +584,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(SolidAngle)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(SolidAngle)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(SolidAngle)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(SolidAngle)) - return this; - else if(conversionType == typeof(SolidAngleUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return SolidAngle.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return SolidAngle.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(SolidAngle)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs index 15e75d5421..a611cd57c6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs @@ -720,106 +720,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(SpecificEnergy)) - return this; - else if(conversionType == typeof(SpecificEnergyUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return SpecificEnergy.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return SpecificEnergy.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(SpecificEnergy)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs index 4e1e01b9dc..57c763ce56 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs @@ -700,106 +700,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(SpecificEntropy)) - return this; - else if(conversionType == typeof(SpecificEntropyUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return SpecificEntropy.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return SpecificEntropy.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(SpecificEntropy)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs index a1ba0f9c43..4aa561a366 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs @@ -615,106 +615,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(SpecificVolume)) - return this; - else if(conversionType == typeof(SpecificVolumeUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return SpecificVolume.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return SpecificVolume.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(SpecificVolume)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs index b1c0bcd696..16aae4ac4b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs @@ -856,106 +856,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(SpecificWeight)) - return this; - else if(conversionType == typeof(SpecificWeightUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return SpecificWeight.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return SpecificWeight.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(SpecificWeight)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs index f32ee64fe8..751708eec9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs @@ -1108,106 +1108,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Speed)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Speed)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Speed)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Speed)) - return this; - else if(conversionType == typeof(SpeedUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Speed.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Speed.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Speed)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs index 63673658e9..395f298705 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs @@ -700,106 +700,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Temperature)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Temperature)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Temperature)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Temperature)) - return this; - else if(conversionType == typeof(TemperatureUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Temperature.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Temperature.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Temperature)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs index 527cbea74e..3d50eae6a1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs @@ -734,106 +734,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(TemperatureChangeRate)) - return this; - else if(conversionType == typeof(TemperatureChangeRateUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return TemperatureChangeRate.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return TemperatureChangeRate.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(TemperatureChangeRate)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs index e63e37e170..59e12f5955 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs @@ -700,106 +700,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(TemperatureDelta)) - return this; - else if(conversionType == typeof(TemperatureDeltaUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return TemperatureDelta.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return TemperatureDelta.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(TemperatureDelta)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs index 12b79f8301..2411245f40 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs @@ -601,106 +601,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ThermalConductivity)) - return this; - else if(conversionType == typeof(ThermalConductivityUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ThermalConductivity.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ThermalConductivity.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ThermalConductivity)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs index e45f4486f1..ee719246c4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs @@ -649,106 +649,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(ThermalResistance)) - return this; - else if(conversionType == typeof(ThermalResistanceUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return ThermalResistance.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return ThermalResistance.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(ThermalResistance)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs index 461b3fb943..d980dce853 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs @@ -921,106 +921,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Torque)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Torque)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Torque)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Torque)) - return this; - else if(conversionType == typeof(TorqueUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Torque.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Torque.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Torque)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs index 3d187554de..cf4693ee00 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs @@ -581,106 +581,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(VitaminA)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(VitaminA)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(VitaminA)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(VitaminA)) - return this; - else if(conversionType == typeof(VitaminAUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return VitaminA.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return VitaminA.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(VitaminA)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs index 8eff741a45..dbea380dfe 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs @@ -1329,106 +1329,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Volume)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Volume)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(Volume)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(Volume)) - return this; - else if(conversionType == typeof(VolumeUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return Volume.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return Volume.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(Volume)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs index 4a04384d95..66ef797b62 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs @@ -1380,106 +1380,5 @@ private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] stri return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; } - #region IConvertible Methods - -#if !WINDOWS_UWP - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Object; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to bool is not supported."); - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return Convert.ToByte(_value); - } - - char IConvertible.ToChar(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to char is not supported."); - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to DateTime is not supported."); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return Convert.ToDecimal(_value); - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return Convert.ToDouble(_value); - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return Convert.ToInt16(_value); - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return Convert.ToInt32(_value); - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return Convert.ToInt64(_value); - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return Convert.ToSByte(_value); - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return Convert.ToSingle(_value); - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - if(conversionType == typeof(VolumeFlow)) - return this; - else if(conversionType == typeof(VolumeFlowUnit)) - return Unit; - else if(conversionType == typeof(QuantityType)) - return VolumeFlow.QuantityType; - else if(conversionType == typeof(BaseDimensions)) - return VolumeFlow.BaseDimensions; - else - throw new InvalidCastException($"Converting {typeof(VolumeFlow)} to {conversionType} is not supported."); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return Convert.ToUInt16(_value); - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return Convert.ToUInt32(_value); - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return Convert.ToUInt64(_value); - } - -#endif - - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index b76a543a03..3d075fdcf5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -813,8 +813,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -909,8 +907,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index f516e239a2..3e131f9557 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -845,8 +845,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -941,8 +939,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs index efb331d2d7..14ca6faa08 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -677,8 +677,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -773,8 +771,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index cc0255abd7..2a87f10fed 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -829,8 +829,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -925,8 +923,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index c19f082762..7ce8256add 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -653,8 +653,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -749,8 +747,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index 50d0e0befc..e5b4958dcc 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -669,8 +669,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -765,8 +763,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index 7363b651bb..f60baf3d63 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -813,8 +813,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -909,8 +907,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index d0884507d1..a52f5d315a 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -621,8 +621,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -717,8 +715,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index 5f776ee2cd..8a4da5d472 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -701,8 +701,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -797,8 +795,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs index d2e10eca7e..1d32bb9e1a 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -1024,8 +1024,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -1120,8 +1118,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index 4f4160ae76..9c2b81befc 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -653,8 +653,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -749,8 +747,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs index 5771a011a8..dd38488ac5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -720,8 +720,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -816,8 +814,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs index 853fd9d1eb..ba09fd13d4 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs @@ -653,8 +653,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -749,8 +747,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index a2969bde7d..603a949dac 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -1232,8 +1232,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -1328,8 +1326,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index c22ef2eca4..a24f853b76 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -765,8 +765,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -861,8 +859,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index 075f58d199..1dc835cadf 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -704,8 +704,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -800,8 +798,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs index 200f5dac38..5df61e50f2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -669,8 +669,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -765,8 +763,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs index 8105685bd0..e5ba266da9 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -624,8 +624,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -720,8 +718,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index 2b85a04995..fc6bbb5cf4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -624,8 +624,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -720,8 +718,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs index 670ed02459..eeb98db596 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -656,8 +656,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -752,8 +750,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs index 3a957e37a8..0a3e35c5b4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -624,8 +624,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -720,8 +718,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs index e1150f1b90..c73a835fb5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -733,8 +733,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -829,8 +827,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs index d572188012..66b00079a6 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -624,8 +624,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -720,8 +718,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs index 14fb9e8615..d5fcfdde4d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -621,8 +621,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -717,8 +715,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs index 64a3f6ed40..30e9db694a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -624,8 +624,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -720,8 +718,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index 7b0d0fb62f..53dbfd42bb 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -672,8 +672,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -768,8 +766,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs index ad3ed57f14..aeb20961b9 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -685,8 +685,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -781,8 +779,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs index fc0618d461..213c81126a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -685,8 +685,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -781,8 +779,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs index d24be17df2..6146be1ef1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -685,8 +685,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -781,8 +779,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs index 827f959be7..51dcdc0eb9 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -685,8 +685,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -781,8 +779,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs index 2516c81fc4..bc250637ec 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -832,8 +832,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -928,8 +926,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs index ae72a83b36..a68f103442 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -957,8 +957,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -1053,8 +1051,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index 4cd7af793c..560a3c6fdc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -717,8 +717,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -813,8 +811,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index 562994021c..ab985b459f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -813,8 +813,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -909,8 +907,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index 07760c84c7..e6c76b1eae 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -781,8 +781,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -877,8 +875,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs index 1258e26772..9fe85f554f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -749,8 +749,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -845,8 +843,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index c5a7000cb6..822bb27001 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -733,8 +733,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -829,8 +827,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index 0e9713b059..857a8ce4de 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -893,8 +893,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -989,8 +987,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index 4a864f41df..a911942b1f 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -637,8 +637,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -733,8 +731,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs index 7f2de54587..65a90129ba 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -672,8 +672,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -768,8 +766,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index 802ed21858..ade1d63a53 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -1021,8 +1021,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -1117,8 +1115,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index e3ab8ef200..bd1f17e84a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -829,8 +829,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -925,8 +923,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index 2b21fc1554..926ae75e58 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -672,8 +672,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -768,8 +766,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index fd7f0f1f74..198691548c 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -736,8 +736,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -832,8 +830,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs index f07b79084b..de198246f2 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -621,8 +621,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -717,8 +715,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index 15da38520a..6b7facd11f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -957,8 +957,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -1053,8 +1051,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index 0dee544d7f..469315e2a2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -645,8 +645,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -741,8 +739,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index 37e29fc7f2..84a32fec85 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -656,8 +656,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -752,8 +750,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index 3e812be1af..3c371c3834 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -624,8 +624,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -720,8 +718,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index 327776db34..4da4f5242c 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -624,8 +624,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -720,8 +718,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs index 407e874fd1..6e8be0c06e 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -672,8 +672,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -768,8 +766,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index 2cc4076c52..e43b55a031 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -624,8 +624,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -720,8 +718,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index 7e10ce5ad1..40a6eee3c3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -624,8 +624,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -720,8 +718,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index 9536d36dfc..659f2f0b86 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -973,8 +973,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -1069,8 +1067,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index ab4492fd1a..d6a6123705 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -1101,8 +1101,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -1197,8 +1195,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index cb725eabbc..bd06b74524 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -637,8 +637,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -733,8 +731,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index f6e3f97bed..eab517dfda 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -1053,8 +1053,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -1149,8 +1147,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs index fa0c72c2e4..0ef59e06cf 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -653,8 +653,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -749,8 +747,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index 8be7b13240..074ed81978 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -653,8 +653,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -749,8 +747,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index fbca1d411c..a3135cf599 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -797,8 +797,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -893,8 +891,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index ec36aa3df4..69a5ef8e01 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -736,8 +736,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -832,8 +830,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index 452ec68dca..81a5fda133 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -624,8 +624,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -720,8 +718,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index 79ad599c06..938298cfb9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -624,8 +624,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -720,8 +718,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index eb457cde5a..f54c361d5b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -925,8 +925,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -1021,8 +1019,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index e7b776e807..a7312ced2e 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -1309,8 +1309,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -1405,8 +1403,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index 54d76abc06..7c31be25a8 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -645,8 +645,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -741,8 +739,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index 0fe58ab147..6bd317e181 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -1277,8 +1277,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -1373,8 +1371,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index 64b4323d45..9ad55a184e 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -717,8 +717,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -813,8 +811,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs index 5c98dc8550..fdf4c72145 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -701,8 +701,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -797,8 +795,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index 10d3abe728..06cd3963a9 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -653,8 +653,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -749,8 +747,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index f6e3468602..02a97e948f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -669,8 +669,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -765,8 +763,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index 41046021fc..4d894e49ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -653,8 +653,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -749,8 +747,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs index 5c7a74f0a3..ad2a91e9f7 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -813,8 +813,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -909,8 +907,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs index f914dbe519..6ff0771350 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -653,8 +653,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -749,8 +747,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs index e1567308bc..29152ffaf4 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -653,8 +653,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -749,8 +747,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs index 42c5409c5b..9732d6f705 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -624,8 +624,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -720,8 +718,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index 1968dafea5..43d2ce8595 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -752,8 +752,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -848,8 +846,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index e8b73bb3b2..7fb87add9c 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -733,8 +733,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -829,8 +827,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs index 039d93a1b8..191c0ff672 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -653,8 +653,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -749,8 +747,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index a3591b20cf..52060818d1 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -880,8 +880,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -976,8 +974,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index 146dbff39f..b1e7a8b13b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -1117,8 +1117,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -1213,8 +1211,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index d4b3ca961b..19c6e96b78 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -694,8 +694,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -790,8 +788,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index 1a76c28814..a8e21fa302 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -765,8 +765,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -861,8 +859,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index 4d56d58ca7..3c7533bcaa 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -733,8 +733,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -829,8 +827,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs index 807319557d..c7ec5a87dc 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -640,8 +640,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -736,8 +734,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs index 12ecc5a30e..61d3e8dd45 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -685,8 +685,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -781,8 +779,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs index 799de4ecae..4559a001ca 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -941,8 +941,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -1037,8 +1035,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index 562d48cfd6..621e19cfd4 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -621,8 +621,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -717,8 +715,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index 11c8a426e8..43a497072b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -1325,8 +1325,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -1421,8 +1419,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index 2b715dea26..3b147db148 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -1373,8 +1373,6 @@ public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string fo #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -1469,8 +1467,6 @@ ulong IConvertible.ToUInt64(IFormatProvider provider) return Convert.ToUInt64(_value); } -#endif - #endregion } } diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index 8ea9502b37..b9d278f356 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -256,10 +256,9 @@ if ($obsoleteAttribute) } "@; }@" +"@; if (!$wrc) {@" #region IConvertible Methods -#if !WINDOWS_UWP - TypeCode IConvertible.GetTypeCode() { return TypeCode.Object; @@ -354,9 +353,8 @@ if ($obsoleteAttribute) return Convert.ToUInt64(_value); } -#endif - #endregion +"@; }@" } } "@;