diff --git a/Src/UnitsNet/GeneratedCode/MassUnit.g.cs b/Src/UnitsNet/GeneratedCode/MassUnit.g.cs
index 6a0213b01c..568e99fc78 100644
--- a/Src/UnitsNet/GeneratedCode/MassUnit.g.cs
+++ b/Src/UnitsNet/GeneratedCode/MassUnit.g.cs
@@ -140,6 +140,15 @@ public double Nanograms
get { return (Kilograms - (0)) / 1E-12; }
}
+ ///
+ /// Get Mass in Pounds.
+ ///
+ /// Example: x = (y - b) / a where x is value in Pounds and y is value in base unit Kilograms.
+ public double Pounds
+ {
+ get { return (Kilograms - (0)) / 0.45359237; }
+ }
+
///
/// Get Mass in ShortTons.
///
@@ -275,6 +284,15 @@ public static Mass FromNanograms(double nanograms)
return new Mass(1E-12 * nanograms + 0);
}
+ ///
+ /// Get Mass from Pounds.
+ ///
+ /// Example: y = ax + b where x is value in Pounds and y is value in base unit Kilograms.
+ public static Mass FromPounds(double pounds)
+ {
+ return new Mass(0.45359237 * pounds + 0);
+ }
+
///
/// Get Mass from ShortTons.
///
diff --git a/Src/UnitsNet/GeneratedCode/UnitConverter.g.cs b/Src/UnitsNet/GeneratedCode/UnitConverter.g.cs
index e0d2c6d0e1..c04ac075a4 100644
--- a/Src/UnitsNet/GeneratedCode/UnitConverter.g.cs
+++ b/Src/UnitsNet/GeneratedCode/UnitConverter.g.cs
@@ -317,6 +317,8 @@ private static bool TryConvertFromMass(double value, Unit fromUnit, Unit toUnit,
return TryConvert(Mass.FromNanograms(value), toUnit, out newValue);
case Unit.ShortTon:
return TryConvert(Mass.FromShortTons(value), toUnit, out newValue);
+ case Unit.Pound:
+ return TryConvert(Mass.FromPounds(value), toUnit, out newValue);
case Unit.LongTon:
return TryConvert(Mass.FromLongTons(value), toUnit, out newValue);
@@ -772,6 +774,9 @@ private static bool TryConvert(Mass value, Unit toUnit, out double newValue)
case Unit.ShortTon:
newValue = value.ShortTons;
return true;
+ case Unit.Pound:
+ newValue = value.Pounds;
+ return true;
case Unit.LongTon:
newValue = value.LongTons;
return true;
diff --git a/Src/UnitsNet/Unit.cs b/Src/UnitsNet/Unit.cs
index 1461da184e..59da4de8db 100644
--- a/Src/UnitsNet/Unit.cs
+++ b/Src/UnitsNet/Unit.cs
@@ -66,6 +66,11 @@ public enum Unit
/// http://en.wikipedia.org/wiki/Short_ton
[Mass(907.18474)] ShortTon,
+ ///
+ /// The pound or pound-mass (abbreviations: lb, lbm) is a unit of mass used in the imperial, United States customary and other systems of measurement. A number of different definitions have been used, the most common today being the international avoirdupois pound which is legally defined as exactly 0.45359237 kilograms, and which is divided into 16 avoirdupois ounces.
+ ///
+ [Mass(0.45359237)] Pound,
+
///
/// Long ton (weight ton or Imperial ton) is a unit of mass equal to 2,240 pounds (1,016 kg) and is the name for the unit called the "ton" in the avoirdupois or Imperial system of measurements that was used in the United Kingdom and several other Commonwealth countries before metrication.
///
diff --git a/Src/UnitsNet/UnitSystem.cs b/Src/UnitsNet/UnitSystem.cs
index e5a8308bf8..f52ad9f288 100644
--- a/Src/UnitsNet/UnitSystem.cs
+++ b/Src/UnitsNet/UnitSystem.cs
@@ -320,9 +320,12 @@ private void CreateCultureInvariants()
MapUnitToAbbreviation(Unit.Decigram, "dg");
MapUnitToAbbreviation(Unit.Centigram, "cg");
MapUnitToAbbreviation(Unit.Milligram, "mg");
+ MapUnitToAbbreviation(Unit.Microgram, "µg");
+ MapUnitToAbbreviation(Unit.Nanogram, "ng");
// Mass (imperial)
MapUnitToAbbreviation(Unit.ShortTon, "short tn");
+ MapUnitToAbbreviation(Unit.Pound, "lb");
MapUnitToAbbreviation(Unit.LongTon, "long tn");
// Pressures
diff --git a/Tests/CustomCode/MassTests.cs b/Tests/CustomCode/MassTests.cs
index cf3e810072..ef68c0ae5c 100644
--- a/Tests/CustomCode/MassTests.cs
+++ b/Tests/CustomCode/MassTests.cs
@@ -73,6 +73,11 @@ public override double ShortTonsInOneKilogram
get { return 0.00110231; }
}
+ public override double PoundsInOneKilogram
+ {
+ get { return 2.2046226218487757d; }
+ }
+
public override double TonnesInOneKilogram
{
get { return 1E-3; }
diff --git a/Tests/GeneratedCode/MassTestsBase.g.cs b/Tests/GeneratedCode/MassTestsBase.g.cs
index ca74f349c9..a5403107ae 100644
--- a/Tests/GeneratedCode/MassTestsBase.g.cs
+++ b/Tests/GeneratedCode/MassTestsBase.g.cs
@@ -47,6 +47,7 @@ public abstract partial class MassTestsBase
public abstract double MicrogramsInOneKilogram { get; }
public abstract double MilligramsInOneKilogram { get; }
public abstract double NanogramsInOneKilogram { get; }
+ public abstract double PoundsInOneKilogram { get; }
public abstract double ShortTonsInOneKilogram { get; }
public abstract double TonnesInOneKilogram { get; }
@@ -66,6 +67,7 @@ public void KilogramToMassUnits()
Assert.AreEqual(MicrogramsInOneKilogram, kilogram.Micrograms, Delta);
Assert.AreEqual(MilligramsInOneKilogram, kilogram.Milligrams, Delta);
Assert.AreEqual(NanogramsInOneKilogram, kilogram.Nanograms, Delta);
+ Assert.AreEqual(PoundsInOneKilogram, kilogram.Pounds, Delta);
Assert.AreEqual(ShortTonsInOneKilogram, kilogram.ShortTons, Delta);
Assert.AreEqual(TonnesInOneKilogram, kilogram.Tonnes, Delta);
}
@@ -86,6 +88,7 @@ public void ConversionRoundTrip()
Assert.AreEqual(1, Mass.FromMicrograms(kilogram.Micrograms).Kilograms, Delta);
Assert.AreEqual(1, Mass.FromMilligrams(kilogram.Milligrams).Kilograms, Delta);
Assert.AreEqual(1, Mass.FromNanograms(kilogram.Nanograms).Kilograms, Delta);
+ Assert.AreEqual(1, Mass.FromPounds(kilogram.Pounds).Kilograms, Delta);
Assert.AreEqual(1, Mass.FromShortTons(kilogram.ShortTons).Kilograms, Delta);
Assert.AreEqual(1, Mass.FromTonnes(kilogram.Tonnes).Kilograms, Delta);
}
diff --git a/Tests/GeneratedCode/UnitConverterTests.g.cs b/Tests/GeneratedCode/UnitConverterTests.g.cs
index 2385a46915..9f77c3da95 100644
--- a/Tests/GeneratedCode/UnitConverterTests.g.cs
+++ b/Tests/GeneratedCode/UnitConverterTests.g.cs
@@ -65,6 +65,7 @@ public void KilogramToMassUnits()
Assert.AreEqual(t.MicrogramsInOneKilogram, UnitConverter.Convert(1, Unit.Kilogram, Unit.Microgram), Delta);
Assert.AreEqual(t.NanogramsInOneKilogram, UnitConverter.Convert(1, Unit.Kilogram, Unit.Nanogram), Delta);
Assert.AreEqual(t.ShortTonsInOneKilogram, UnitConverter.Convert(1, Unit.Kilogram, Unit.ShortTon), Delta);
+ Assert.AreEqual(t.PoundsInOneKilogram, UnitConverter.Convert(1, Unit.Kilogram, Unit.Pound), Delta);
Assert.AreEqual(t.LongTonsInOneKilogram, UnitConverter.Convert(1, Unit.Kilogram, Unit.LongTon), Delta);
}
[Test]