diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs
index 14edd9e1bf..b363c11d0b 100644
--- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs
@@ -134,6 +134,8 @@ public BitRate(decimal numericValue, BitRateUnit unit)
///
public decimal Value => _value;
+ double IQuantity.Value => (double) _value;
+
///
Enum IQuantity.Unit => Unit;
diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs
index 3f6d0dc384..088d117102 100644
--- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs
@@ -131,6 +131,8 @@ public Information(decimal numericValue, InformationUnit unit)
///
public decimal Value => _value;
+ double IQuantity.Value => (double) _value;
+
///
Enum IQuantity.Unit => Unit;
diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs
index e768a314f7..36f1abd57e 100644
--- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs
@@ -131,6 +131,8 @@ public Power(decimal numericValue, PowerUnit unit)
///
public decimal Value => _value;
+ double IQuantity.Value => (double) _value;
+
///
Enum IQuantity.Unit => Unit;
diff --git a/UnitsNet/IQuantity.cs b/UnitsNet/IQuantity.cs
index 88498c2624..569d20ca01 100644
--- a/UnitsNet/IQuantity.cs
+++ b/UnitsNet/IQuantity.cs
@@ -28,7 +28,7 @@ namespace UnitsNet
///
/// Represents a quantity.
///
- public partial interface IQuantity
+ public interface IQuantity
{
///
/// The of this quantity.
@@ -58,6 +58,11 @@ public partial interface IQuantity
///
Enum Unit { get; }
+ ///
+ /// The value this quantity was constructed with. Should be seen in combination with .
+ ///
+ double Value { get; }
+
///
/// Change the default unit representation of the quantity, which affects things like .
///
diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCode.ps1
index 5cc4e7ff14..8634d84904 100644
--- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCode.ps1
+++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCode.ps1
@@ -348,8 +348,8 @@ function GenerateProperties([GeneratorArgs]$genArgs)
{
$quantityName = $genArgs.Quantity.Name
$unitEnumName = $genArgs.UnitEnumName
- $baseUnitSingularName = $genArgs.BaseUnit.SingularName
$valueType = $genArgs.Quantity.BaseType
+ [bool]$isDoubleValueType = $valueType -eq "double"
@"
#region Properties
@@ -359,6 +359,10 @@ function GenerateProperties([GeneratorArgs]$genArgs)
///
public $valueType Value => _value;
+"@; if (-not $isDoubleValueType) { @"
+ double IQuantity.Value => (double) _value;
+
+"@; } @"
///
Enum IQuantity.Unit => Unit;