diff --git a/CodeGen/Generators/QuantityJsonFilesParser.cs b/CodeGen/Generators/QuantityJsonFilesParser.cs
index a9393e9efa..e1d50871a7 100644
--- a/CodeGen/Generators/QuantityJsonFilesParser.cs
+++ b/CodeGen/Generators/QuantityJsonFilesParser.cs
@@ -6,123 +6,89 @@
using System.IO;
using System.Linq;
using CodeGen.Exceptions;
-using CodeGen.Helpers;
+using CodeGen.Helpers.PrefixBuilder;
using CodeGen.JsonTypes;
using Newtonsoft.Json;
+using static CodeGen.Helpers.PrefixBuilder.BaseUnitPrefixes;
-namespace CodeGen.Generators
+namespace CodeGen.Generators;
+
+///
+/// Parses JSON files that define quantities and their units.
+/// This will later be used to generate source code and can be reused for different targets such as .NET framework,
+/// .NET Core, .NET nanoFramework and even other programming languages.
+///
+internal static class QuantityJsonFilesParser
{
+ private static readonly JsonSerializerSettings JsonSerializerSettings = new()
+ {
+ // Don't override the C# default assigned values if no value is set in JSON
+ NullValueHandling = NullValueHandling.Ignore
+ };
+
+ private static readonly string[] BaseQuantityFileNames =
+ ["Length", "Mass", "Duration", "ElectricCurrent", "Temperature", "AmountOfSubstance", "LuminousIntensity"];
+
///
/// Parses JSON files that define quantities and their units.
- /// This will later be used to generate source code and can be reused for different targets such as .NET framework,
- /// .NET Core, .NET nanoFramework and even other programming languages.
///
- internal static class QuantityJsonFilesParser
+ /// Repository root directory, where you cloned the repo to such as "c:\dev\UnitsNet".
+ /// The parsed quantities and their units.
+ public static Quantity[] ParseQuantities(string rootDir)
{
- private static readonly JsonSerializerSettings JsonSerializerSettings = new JsonSerializerSettings
- {
- // Don't override the C# default assigned values if no value is set in JSON
- NullValueHandling = NullValueHandling.Ignore
- };
+ var jsonDir = Path.Combine(rootDir, "Common/UnitDefinitions");
+ var baseQuantityFiles = BaseQuantityFileNames.Select(baseQuantityName => Path.Combine(jsonDir, baseQuantityName + ".json")).ToArray();
- ///
- /// Parses JSON files that define quantities and their units.
- ///
- /// Repository root directory, where you cloned the repo to such as "c:\dev\UnitsNet".
- /// The parsed quantities and their units.
- public static Quantity[] ParseQuantities(string rootDir)
- {
- var jsonDir = Path.Combine(rootDir, "Common/UnitDefinitions");
- var jsonFileNames = Directory.GetFiles(jsonDir, "*.json");
- return jsonFileNames
- .OrderBy(fn => fn, StringComparer.InvariantCultureIgnoreCase)
- .Select(ParseQuantityFile)
- .ToArray();
- }
+ Quantity[] baseQuantities = ParseQuantities(baseQuantityFiles);
+ Quantity[] derivedQuantities = ParseQuantities(Directory.GetFiles(jsonDir, "*.json").Except(baseQuantityFiles));
- private static Quantity ParseQuantityFile(string jsonFileName)
- {
- try
- {
- var quantity = JsonConvert.DeserializeObject(File.ReadAllText(jsonFileName), JsonSerializerSettings)
- ?? throw new UnitsNetCodeGenException($"Unable to parse quantity from JSON file: {jsonFileName}");
+ return BuildQuantities(baseQuantities, derivedQuantities);
+ }
- AddPrefixUnits(quantity);
- OrderUnitsByName(quantity);
- return quantity;
- }
- catch (Exception e)
- {
- throw new Exception($"Error parsing quantity JSON file: {jsonFileName}", e);
- }
- }
+ private static Quantity[] ParseQuantities(IEnumerable jsonFiles)
+ {
+ return jsonFiles.Select(ParseQuantity).ToArray();
+ }
- private static void OrderUnitsByName(Quantity quantity)
+ private static Quantity ParseQuantity(string jsonFileName)
+ {
+ try
{
- quantity.Units = quantity.Units.OrderBy(u => u.SingularName, StringComparer.OrdinalIgnoreCase).ToArray();
+ return JsonConvert.DeserializeObject(File.ReadAllText(jsonFileName), JsonSerializerSettings)
+ ?? throw new UnitsNetCodeGenException($"Unable to parse quantity from JSON file: {jsonFileName}");
}
-
- private static void AddPrefixUnits(Quantity quantity)
+ catch (Exception e)
{
- var unitsToAdd = new List();
- foreach (Unit unit in quantity.Units)
- foreach (Prefix prefix in unit.Prefixes)
- {
- try
- {
- var prefixInfo = PrefixInfo.Entries[prefix];
-
- unitsToAdd.Add(new Unit
- {
- SingularName = $"{prefix}{unit.SingularName.ToCamelCase()}", // "Kilo" + "NewtonPerMeter" => "KilonewtonPerMeter"
- PluralName = $"{prefix}{unit.PluralName.ToCamelCase()}", // "Kilo" + "NewtonsPerMeter" => "KilonewtonsPerMeter"
- BaseUnits = null, // Can we determine this somehow?
- FromBaseToUnitFunc = $"({unit.FromBaseToUnitFunc}) / {prefixInfo.Factor}",
- FromUnitToBaseFunc = $"({unit.FromUnitToBaseFunc}) * {prefixInfo.Factor}",
- Localization = GetLocalizationForPrefixUnit(unit.Localization, prefixInfo),
- ObsoleteText = unit.ObsoleteText,
- SkipConversionGeneration = unit.SkipConversionGeneration,
- AllowAbbreviationLookup = unit.AllowAbbreviationLookup
- } );
- }
- catch (Exception e)
- {
- throw new Exception($"Error parsing prefix {prefix} for unit {quantity.Name}.{unit.SingularName}.", e);
- }
- }
-
- quantity.Units = quantity.Units.Concat(unitsToAdd).ToArray();
+ throw new Exception($"Error parsing quantity JSON file: {jsonFileName}", e);
}
+ }
- ///
- /// Create unit abbreviations for a prefix unit, given a unit and the prefix.
- /// The unit abbreviations are either prefixed with the SI prefix or an explicitly configured abbreviation via
- /// .
- ///
- private static Localization[] GetLocalizationForPrefixUnit(IEnumerable localizations, PrefixInfo prefixInfo)
+ ///
+ /// Combines base quantities and derived quantities into a single collection,
+ /// while generating prefixed units for each quantity.
+ ///
+ ///
+ /// The array of base quantities, each containing its respective units.
+ ///
+ ///
+ /// The array of derived quantities, each containing its respective units.
+ ///
+ ///
+ /// An ordered array of all quantities, including both base and derived quantities,
+ /// with prefixed units generated and added to their respective unit collections.
+ ///
+ ///
+ /// This method utilizes the to generate prefixed units
+ /// for each quantity. The resulting quantities are sorted alphabetically by their names.
+ ///
+ private static Quantity[] BuildQuantities(Quantity[] baseQuantities, Quantity[] derivedQuantities)
+ {
+ var prefixBuilder = new UnitPrefixBuilder(FromBaseUnits(baseQuantities.SelectMany(x => x.Units)));
+ return baseQuantities.Concat(derivedQuantities).Select(quantity =>
{
- return localizations.Select(loc =>
- {
- if (loc.TryGetAbbreviationsForPrefix(prefixInfo.Prefix, out string[]? unitAbbreviationsForPrefix))
- {
- return new Localization
- {
- Culture = loc.Culture,
- Abbreviations = unitAbbreviationsForPrefix
- };
- }
-
- // No prefix unit abbreviations are specified, so fall back to prepending the default SI prefix to each unit abbreviation:
- // kilo ("k") + meter ("m") => kilometer ("km")
- var prefix = prefixInfo.GetPrefixForCultureOrSiPrefix(loc.Culture);
- unitAbbreviationsForPrefix = loc.Abbreviations.Select(unitAbbreviation => $"{prefix}{unitAbbreviation}").ToArray();
-
- return new Localization
- {
- Culture = loc.Culture,
- Abbreviations = unitAbbreviationsForPrefix
- };
- }).ToArray();
- }
+ List prefixedUnits = prefixBuilder.GeneratePrefixUnits(quantity);
+ quantity.Units = quantity.Units.Concat(prefixedUnits).OrderBy(unit => unit.SingularName, StringComparer.OrdinalIgnoreCase).ToArray();
+ return quantity;
+ }).OrderBy(quantity => quantity.Name, StringComparer.InvariantCultureIgnoreCase).ToArray();
}
}
diff --git a/CodeGen/Helpers/PrefixBuilder/BaseUnitPrefix.cs b/CodeGen/Helpers/PrefixBuilder/BaseUnitPrefix.cs
new file mode 100644
index 0000000000..c8a11470ab
--- /dev/null
+++ b/CodeGen/Helpers/PrefixBuilder/BaseUnitPrefix.cs
@@ -0,0 +1,17 @@
+// Licensed under MIT No Attribution, see LICENSE file at the root.
+// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
+
+using CodeGen.JsonTypes;
+
+namespace CodeGen.Helpers.PrefixBuilder;
+
+///
+/// Represents a unique key that combines a base unit and a prefix.
+///
+///
+/// The base unit associated with the prefix. For example, "Gram".
+///
+///
+/// The prefix applied to the base unit. For example, .
+///
+internal readonly record struct BaseUnitPrefix(string BaseUnit, Prefix Prefix);
diff --git a/CodeGen/Helpers/PrefixBuilder/BaseUnitPrefixes.cs b/CodeGen/Helpers/PrefixBuilder/BaseUnitPrefixes.cs
new file mode 100644
index 0000000000..bd64d4a5b1
--- /dev/null
+++ b/CodeGen/Helpers/PrefixBuilder/BaseUnitPrefixes.cs
@@ -0,0 +1,165 @@
+// Licensed under MIT No Attribution, see LICENSE file at the root.
+// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
+
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using CodeGen.JsonTypes;
+
+namespace CodeGen.Helpers.PrefixBuilder;
+
+///
+/// Represents a collection of base unit prefixes and their associated mappings.
+///
+///
+/// This class provides functionality to manage and retrieve mappings between base units and their prefixed
+/// counterparts,
+/// including scale factors and prefixed unit names. It supports operations such as creating mappings from a collection
+/// of base units and finding matching prefixes for specific units.
+///
+internal class BaseUnitPrefixes
+{
+ ///
+ /// A dictionary that maps metric prefixes to their corresponding exponent values.
+ ///
+ ///
+ /// This dictionary excludes binary prefixes such as Kibi, Mebi, Gibi, Tebi, Pebi, and Exbi.
+ ///
+ private static readonly Dictionary MetricPrefixFactors = PrefixInfo.Entries.Where(x => x.Key.IsMetricPrefix())
+ .ToDictionary(pair => pair.Key, pair => pair.Value.GetDecimalExponent());
+
+ ///
+ /// A dictionary that maps the exponent values to their corresponding .
+ /// This is used to find the appropriate prefix for a given factor.
+ ///
+ private static readonly Dictionary PrefixFactorsByValue = MetricPrefixFactors.ToDictionary(pair => pair.Value, pair => pair.Key);
+
+ ///
+ /// Lookup of prefixed unit name from base unit + prefix pairs, such as ("Gram", Prefix.Kilo) => "Kilogram".
+ ///
+ private readonly Dictionary _baseUnitPrefixConversions;
+
+ ///
+ /// A dictionary that maps prefixed unit strings to their corresponding base unit and fractional factor.
+ ///
+ ///
+ /// This dictionary is used to handle units with SI prefixes, allowing for the conversion of prefixed units
+ /// to their base units and the associated fractional factors. The keys are the prefixed unit strings, and the values
+ /// are tuples containing the base unit string and the fractional factor.
+ ///
+ private readonly Dictionary _prefixedStringFactors;
+
+ private BaseUnitPrefixes(Dictionary prefixedStringFactors, Dictionary baseUnitPrefixConversions)
+ {
+ _prefixedStringFactors = prefixedStringFactors;
+ _baseUnitPrefixConversions = baseUnitPrefixConversions;
+ }
+
+ ///
+ /// Creates an instance of from a collection of base units.
+ ///
+ ///
+ /// A collection of base units, each containing a singular name and associated prefixes.
+ ///
+ ///
+ /// A new instance of containing mappings of base units
+ /// and their prefixed counterparts.
+ ///
+ ///
+ /// This method processes the provided base units to generate mappings between base unit prefixes
+ /// and their corresponding prefixed unit names, as well as scale factors for each prefixed unit.
+ ///
+ public static BaseUnitPrefixes FromBaseUnits(IEnumerable baseUnits)
+ {
+ var baseUnitPrefixConversions = new Dictionary();
+ var prefixedStringFactors = new Dictionary();
+ foreach (Unit baseUnit in baseUnits)
+ {
+ var unitName = baseUnit.SingularName;
+ prefixedStringFactors[unitName] = new PrefixScaleFactor(unitName, 0);
+ foreach (Prefix prefix in baseUnit.Prefixes)
+ {
+ var prefixedUnitName = prefix + unitName.ToCamelCase();
+ baseUnitPrefixConversions[new BaseUnitPrefix(unitName, prefix)] = prefixedUnitName;
+ prefixedStringFactors[prefixedUnitName] = new PrefixScaleFactor(unitName, MetricPrefixFactors[prefix]);
+ }
+ }
+
+ return new BaseUnitPrefixes(prefixedStringFactors, baseUnitPrefixConversions);
+ }
+
+ ///
+ /// Attempts to find a matching prefix for a given unit name, exponent, and prefix.
+ ///
+ ///
+ /// The name of the unit to match. For example, "Meter".
+ ///
+ ///
+ /// The exponent associated with the unit. For example, 3 for cubic meters.
+ ///
+ ///
+ /// The prefix to match. For example, .
+ ///
+ ///
+ /// When this method returns, contains the matching if a match is found;
+ /// otherwise, the default value of .
+ ///
+ ///
+ /// if a matching prefix is found; otherwise, .
+ ///
+ ///
+ /// This method determines if a given unit can be associated with a specific prefix, given the exponent of the
+ /// associated dimension.
+ ///
+ internal bool TryGetMatchingPrefix(string unitName, int exponent, Prefix prefix, out BaseUnitPrefix matchingPrefix)
+ {
+ if (exponent == 0 || !_prefixedStringFactors.TryGetValue(unitName, out PrefixScaleFactor? targetPrefixFactor))
+ {
+ matchingPrefix = default;
+ return false;
+ }
+
+ if (MetricPrefixFactors.TryGetValue(prefix, out var prefixFactor))
+ {
+ var (quotient, remainder) = int.DivRem(prefixFactor, exponent);
+ // Ensure the prefix factor is divisible by the exponent without a remainder and that there is a valid prefix matching the target scale
+ if (remainder == 0 && TryGetPrefixWithScale(targetPrefixFactor.ScaleFactor + quotient, out Prefix calculatedPrefix))
+ {
+ matchingPrefix = new BaseUnitPrefix(targetPrefixFactor.BaseUnit, calculatedPrefix);
+ return true;
+ }
+ }
+
+ matchingPrefix = default;
+ return false;
+ }
+
+ private static bool TryGetPrefixWithScale(int logScale, out Prefix calculatedPrefix)
+ {
+ return PrefixFactorsByValue.TryGetValue(logScale, out calculatedPrefix);
+ }
+
+ ///
+ /// Attempts to retrieve the prefixed unit name for a given base unit and prefix combination.
+ ///
+ ///
+ /// A representing the combination of a base unit and a prefix.
+ ///
+ ///
+ /// When this method returns, contains the prefixed unit name if the lookup was successful; otherwise, null.
+ ///
+ ///
+ /// true if the prefixed unit name was successfully retrieved; otherwise, false.
+ ///
+ internal bool TryGetPrefixForUnit(BaseUnitPrefix prefix, [NotNullWhen(true)] out string? prefixedUnitName)
+ {
+ return _baseUnitPrefixConversions.TryGetValue(prefix, out prefixedUnitName);
+ }
+
+ ///
+ /// Represents the scaling factor that is required for converting from the .
+ ///
+ /// Name of base unit, e.g. "Meter".
+ /// The log-scale factor, e.g. 3 for kilometer.
+ private record PrefixScaleFactor(string BaseUnit, int ScaleFactor);
+}
diff --git a/CodeGen/Helpers/PrefixBuilder/PrefixBuilderExtensions.cs b/CodeGen/Helpers/PrefixBuilder/PrefixBuilderExtensions.cs
new file mode 100644
index 0000000000..a39c526ffa
--- /dev/null
+++ b/CodeGen/Helpers/PrefixBuilder/PrefixBuilderExtensions.cs
@@ -0,0 +1,105 @@
+// Licensed under MIT No Attribution, see LICENSE file at the root.
+// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using CodeGen.JsonTypes;
+
+namespace CodeGen.Helpers.PrefixBuilder;
+
+///
+/// Provides extension methods for working with , ,
+/// and types, enabling operations such as determining metric prefixes,
+/// calculating decimal exponents, and retrieving non-zero exponents from base dimensions.
+///
+///
+/// This static class contains utility methods designed to simplify and enhance the manipulation
+/// of prefix-related data and base dimensions in the context of code generation.
+///
+internal static class PrefixBuilderExtensions
+{
+ ///
+ /// Determines whether the specified is a metric prefix.
+ ///
+ /// The to evaluate.
+ ///
+ /// true if the is a metric prefix (ranging from to
+ /// );
+ /// otherwise, false.
+ ///
+ internal static bool IsMetricPrefix(this Prefix prefix)
+ {
+ return prefix is >= Prefix.Yocto and <= Prefix.Yotta;
+ }
+
+ ///
+ /// Calculates the decimal exponent of a metric prefix factor.
+ ///
+ ///
+ /// The instance representing the metric prefix whose decimal exponent is to be calculated.
+ ///
+ ///
+ /// The decimal exponent as an integer, derived from the logarithm base 10 of the prefix factor.
+ ///
+ ///
+ /// This method assumes that the factor is a valid numeric string representing a power of ten.
+ ///
+ internal static int GetDecimalExponent(this PrefixInfo prefix)
+ {
+ return (int)Math.Log10(double.Parse(prefix.Factor.TrimEnd('d'), NumberStyles.Any, CultureInfo.InvariantCulture));
+ }
+
+ ///
+ /// Retrieves all non-zero exponents from the specified instance.
+ ///
+ ///
+ /// The instance containing the exponents to evaluate.
+ ///
+ ///
+ /// An of integers representing the non-zero exponents in the specified dimensions.
+ ///
+ ///
+ /// This method iterates through the properties of the instance and yields
+ /// only those exponents that are non-zero. The properties correspond to the base physical dimensions
+ /// such as time (T), length (L), mass (M), electric current (I), absolute temperature (Θ),
+ /// amount of substance (N), and luminous intensity (J).
+ ///
+ internal static IEnumerable GetNonZeroExponents(this BaseDimensions dimensions)
+ {
+ if (dimensions.I != 0)
+ {
+ yield return dimensions.I;
+ }
+
+ if (dimensions.J != 0)
+ {
+ yield return dimensions.J;
+ }
+
+ if (dimensions.L != 0)
+ {
+ yield return dimensions.L;
+ }
+
+ if (dimensions.M != 0)
+ {
+ yield return dimensions.M;
+ }
+
+ if (dimensions.N != 0)
+ {
+ yield return dimensions.N;
+ }
+
+ if (dimensions.T != 0)
+ {
+ yield return dimensions.T;
+ }
+
+ if (dimensions.Θ != 0)
+ {
+ yield return dimensions.Θ;
+ }
+ }
+}
diff --git a/CodeGen/Helpers/PrefixBuilder/UnitPrefixBuilder.cs b/CodeGen/Helpers/PrefixBuilder/UnitPrefixBuilder.cs
new file mode 100644
index 0000000000..7ef1a63139
--- /dev/null
+++ b/CodeGen/Helpers/PrefixBuilder/UnitPrefixBuilder.cs
@@ -0,0 +1,334 @@
+// Licensed under MIT No Attribution, see LICENSE file at the root.
+// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using CodeGen.JsonTypes;
+
+namespace CodeGen.Helpers.PrefixBuilder;
+
+///
+/// Provides functionality for building the prefixed units of a .
+///
+///
+/// This class is responsible for generating prefixed units by applying defined prefixes to existing units.
+/// It utilizes the to handle prefix configurations and conversions.
+///
+internal class UnitPrefixBuilder
+{
+ private readonly BaseUnitPrefixes _prefixes;
+
+ ///
+ /// Initializes a new instance of the class with the specified base unit prefixes.
+ ///
+ ///
+ /// The instance containing the base unit prefixes to be used.
+ /// This parameter must not be null.
+ ///
+ public UnitPrefixBuilder(BaseUnitPrefixes prefixes)
+ {
+ _prefixes = prefixes;
+ }
+
+ ///
+ /// Generates a list of prefixed units for the specified by applying all defined prefixes
+ /// to its existing units.
+ ///
+ ///
+ /// The for which prefixed units will be generated. This parameter must not be null.
+ ///
+ ///
+ /// A list of newly created objects that represent the prefixed units.
+ ///
+ ///
+ /// Thrown when an error occurs while processing a prefix for a unit, such as an invalid prefix or unit configuration.
+ ///
+ ///
+ /// This method iterates through the existing units of the specified and applies each defined
+ /// prefix to generate new prefixed units. It ensures that the singular and plural names, conversion functions,
+ /// localization, and other properties are appropriately updated for the newly created units.
+ ///
+ public List GeneratePrefixUnits(Quantity quantity)
+ {
+ var unitsToAdd = new List();
+ foreach (Unit unit in quantity.Units)
+ foreach (Prefix prefix in unit.Prefixes)
+ {
+ try
+ {
+ PrefixInfo prefixInfo = PrefixInfo.Entries[prefix];
+
+ unitsToAdd.Add(new Unit
+ {
+ SingularName = $"{prefix}{unit.SingularName.ToCamelCase()}", // "Kilo" + "NewtonPerMeter" => "KilonewtonPerMeter"
+ PluralName = $"{prefix}{unit.PluralName.ToCamelCase()}", // "Kilo" + "NewtonsPerMeter" => "KilonewtonsPerMeter"
+ BaseUnits = GetPrefixedBaseUnits(quantity.BaseDimensions, unit.BaseUnits, prefixInfo),
+ FromBaseToUnitFunc = $"({unit.FromBaseToUnitFunc}) / {prefixInfo.Factor}",
+ FromUnitToBaseFunc = $"({unit.FromUnitToBaseFunc}) * {prefixInfo.Factor}",
+ Localization = GetLocalizationForPrefixUnit(unit.Localization, prefixInfo),
+ ObsoleteText = unit.ObsoleteText,
+ SkipConversionGeneration = unit.SkipConversionGeneration,
+ AllowAbbreviationLookup = unit.AllowAbbreviationLookup
+ });
+ }
+ catch (Exception e)
+ {
+ throw new Exception($"Error parsing prefix {prefix} for unit {quantity.Name}.{unit.SingularName}.", e);
+ }
+ }
+
+ return unitsToAdd;
+ }
+
+ ///
+ /// Applies a metric prefix to the specified base units based on the given dimensions and prefix information.
+ ///
+ ///
+ /// The SI base unit dimensions of the quantity, such as L=1 for Length or T=-1 for Speed.
+ ///
+ ///
+ /// The SI base units for a non-prefixed unit, for example, L=Meter for Length.Meter or L=Meter, T=Second for
+ /// Speed.MeterPerSecond.
+ ///
+ ///
+ /// The information about the metric prefix to apply, including its factor and symbol.
+ ///
+ ///
+ /// A new instance of with the metric prefix applied, or null if no matching
+ /// prefixed base units could be determined.
+ /// Note that even if is not null, the result may still be null if no valid
+ /// prefixed base units are found.
+ ///
+ ///
+ /// The algorithm attempts to find matching prefixed base units by iterating through the non-zero dimension exponents
+ /// of the provided . The exponents are processed in ascending order of their absolute
+ /// values, with positive exponents being prioritized over negative ones. This approach improves the likelihood of
+ /// finding a
+ /// match that does not deviate too much from the desired prefix.
+ ///
+ ///
+ /// Examples of determining base units of prefix units:
+ ///
+ /// -
+ /// Example 1 - Pressure.Micropascal
+ ///
+ ///
+ /// This highlights how UnitsNet chose Gram as the conversion base unit, while SI defines Kilogram as
+ /// the base mass unit.
+ ///
+ ///
+ /// Requested prefix: Micro (scale -6) for pressure unit Pascal
+ /// SI base units of Pascal: L=Meter, M=Kilogram, T=Second
+ /// SI base dimensions, ordered: M=1, L=-1, T=-2
+ /// Trying first dimension M=1:
+ /// SI base mass unit is Kilogram, but UnitsNet base mass unit is Gram so base prefix scale is 3
+ /// Inferred prefix is Milli: base prefix scale 3 + requested prefix scale (-6) = -3
+ /// ✅ Resulting base units: M=Milligram plus the original L=Meter, T=Second
+ ///
+ ///
+ ///
+ /// -
+ /// Example 2 - Pressure.Millipascal
+ ///
+ ///
+ /// Similar to example 1, but this time Length is used instead of Mass due to the base unit scale
+ /// factor of mass canceling out the requested prefix.
+ ///
+ ///
+ /// Requested prefix: Milli (scale -3) for pressure unit Pascal
+ /// SI base units of Pascal: L=Meter, M=Kilogram, T=Second
+ /// SI base dimensions, ordered: M=1, L=-1, T=-2
+ /// Trying first dimension M=1:
+ /// SI base unit in mass dimension is Kilogram, but configured base unit is Gram so base prefix scale is 3
+ /// ❌ No inferred prefix: base prefix scale 3 + requested prefix scale (-3) = 0
+ /// Trying second dimension L=-1:
+ /// SI base unit in length dimension is Meter, same as configured base unit, so base prefix scale is 0
+ /// Inferred prefix is Milli: base prefix scale 0 + requested prefix scale (-3) = -3
+ /// ✅ Resulting base units: M=Millimeter plus the original M=Kilogram, T=Second
+ ///
+ ///
+ ///
+ /// -
+ /// Example 3 - ElectricApparentPower.Kilovoltampere
+ ///
+ ///
+ /// This example demonstrates cases where determining the base units for certain prefixes is not
+ /// possible or trivial.
+ ///
+ ///
+ /// Requested prefix: Kilo (scale 3) for unit Voltampere
+ /// SI base units of Voltampere: L=Meter, M=Kilogram, T=Second
+ /// SI base dimensions, ordered: M=1, L=2, T=-3
+ /// Trying first dimension M=1:
+ /// SI base unit in mass dimension is Kilogram, same as configured base unit, so base prefix scale is 0
+ /// Inferred prefix is Kilo: base prefix scale 0 + requested prefix scale (3) = 3
+ /// ❌ Kilo prefix for Kilogram unit would be Megagram, but there is no unit Megagram, since Gram does not have this prefix (we could add it)
+ /// Trying second dimension L=2:
+ /// ❌ There is no metric prefix we can raise to the power of 2 and get Kilo, e.g., Deca*Deca = Hecto, Kilo*Kilo = Mega, etc.
+ /// Trying third dimension T=-3:
+ /// SI base unit in time dimension is Second, same as configured base unit, so base prefix scale is 0
+ /// Inferred prefix is Deci: (base prefix scale 0 + requested prefix scale (-3)) / exponent -3 = -3 / -3 = 1
+ /// ❌ There is no Duration unit Decasecond (we could add it)
+ ///
+ ///
+ ///
+ ///
+ ///
+ private BaseUnits? GetPrefixedBaseUnits(BaseDimensions dimensions, BaseUnits? baseUnits, PrefixInfo prefixInfo)
+ {
+ if (baseUnits is null) return null;
+
+ // Iterate the non-zero dimension exponents in absolute-increasing order, positive first [1, -1, 2, -2...n, -n]
+ foreach (var degree in dimensions.GetNonZeroExponents().OrderBy(int.Abs).ThenByDescending(x => x))
+ {
+ if (TryPrefixWithExponent(dimensions, baseUnits, prefixInfo.Prefix, degree, out BaseUnits? prefixedUnits))
+ {
+ return prefixedUnits;
+ }
+ }
+
+ return null;
+ }
+
+ ///
+ /// Attempts to apply a specified prefix to a base unit based on a given exponent.
+ ///
+ ///
+ /// The base dimensions containing the exponents for each dimension (e.g., length, mass, time).
+ ///
+ ///
+ /// The base units to which the prefix will be applied.
+ ///
+ ///
+ /// The prefix to be applied (e.g., Kilo, Milli, Micro).
+ ///
+ ///
+ /// The exponent of the dimension to which the prefix should be applied.
+ ///
+ ///
+ /// When this method returns, contains the prefixed base units if the operation was successful; otherwise, null.
+ ///
+ ///
+ /// true if the prefix was successfully applied to the base unit; otherwise, false.
+ ///
+ private bool TryPrefixWithExponent(BaseDimensions dimensions, BaseUnits baseUnits, Prefix prefix, int exponent,
+ [NotNullWhen(true)] out BaseUnits? prefixedBaseUnits)
+ {
+ prefixedBaseUnits = baseUnits.Clone();
+
+ // look for a dimension that is part of the non-zero exponents
+ if (baseUnits.N is { } baseAmountUnit && dimensions.N == exponent)
+ {
+ if (TryPrefixUnit(baseAmountUnit, exponent, prefix, out var newAmount))
+ {
+ prefixedBaseUnits.N = newAmount;
+ return true;
+ }
+ }
+
+ if (baseUnits.I is { } baseCurrentUnit && dimensions.I == exponent)
+ {
+ if (TryPrefixUnit(baseCurrentUnit, exponent, prefix, out var newCurrent))
+ {
+ prefixedBaseUnits.I = newCurrent;
+ return true;
+ }
+ }
+
+ if (baseUnits.L is { } baseLengthUnit && dimensions.L == exponent)
+ {
+ if (TryPrefixUnit(baseLengthUnit, exponent, prefix, out var newLength))
+ {
+ prefixedBaseUnits.L = newLength;
+ return true;
+ }
+ }
+
+ if (baseUnits.J is { } baseLuminosityUnit && dimensions.J == exponent)
+ {
+ if (TryPrefixUnit(baseLuminosityUnit, exponent, prefix, out var newLuminosity))
+ {
+ prefixedBaseUnits.J = newLuminosity;
+ return true;
+ }
+ }
+
+ if (baseUnits.M is { } baseMassUnit && dimensions.M == exponent)
+ {
+ if (TryPrefixUnit(baseMassUnit, exponent, prefix, out var newMass))
+ {
+ prefixedBaseUnits.M = newMass;
+ return true;
+ }
+ }
+
+ if (baseUnits.Θ is { } baseTemperatureUnit && dimensions.Θ == exponent)
+ {
+ if (TryPrefixUnit(baseTemperatureUnit, exponent, prefix, out var newTemperature))
+ {
+ prefixedBaseUnits.Θ = newTemperature;
+ return true;
+ }
+ }
+
+ if (baseUnits.T is { } baseDurationUnit && dimensions.T == exponent)
+ {
+ if (TryPrefixUnit(baseDurationUnit, exponent, prefix, out var newTime))
+ {
+ prefixedBaseUnits.T = newTime;
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ ///
+ /// Attempts to apply a specified prefix to a unit name based on the given exponent and prefix.
+ ///
+ /// The name of the unit to which the prefix should be applied.
+ /// The exponent associated with the unit, used to determine compatibility with the prefix.
+ /// The to be applied to the unit.
+ ///
+ /// When this method returns, contains the prefixed unit name if the operation was successful; otherwise, null.
+ ///
+ ///
+ /// true if a matching prefix was found; otherwise, false.
+ ///
+ private bool TryPrefixUnit(string unitName, int exponent, Prefix prefix, [NotNullWhen(true)] out string? prefixedUnitName)
+ {
+ if (_prefixes.TryGetMatchingPrefix(unitName, exponent, prefix, out BaseUnitPrefix unitPrefix) &&
+ _prefixes.TryGetPrefixForUnit(unitPrefix, out prefixedUnitName))
+ {
+ return true;
+ }
+
+ prefixedUnitName = null;
+ return false;
+ }
+
+ ///
+ /// Create unit abbreviations for a prefix unit, given a unit and the prefix.
+ /// The unit abbreviations are either prefixed with the SI prefix or an explicitly configured abbreviation via
+ /// .
+ ///
+ private static Localization[] GetLocalizationForPrefixUnit(IEnumerable localizations, PrefixInfo prefixInfo)
+ {
+ return localizations.Select(loc =>
+ {
+ if (loc.TryGetAbbreviationsForPrefix(prefixInfo.Prefix, out var unitAbbreviationsForPrefix))
+ {
+ return new Localization { Culture = loc.Culture, Abbreviations = unitAbbreviationsForPrefix };
+ }
+
+ // No prefix unit abbreviations are specified, so fall back to prepending the default SI prefix to each unit abbreviation:
+ // kilo ("k") + meter ("m") => kilometer ("km")
+ var prefix = prefixInfo.GetPrefixForCultureOrSiPrefix(loc.Culture);
+ unitAbbreviationsForPrefix = loc.Abbreviations.Select(unitAbbreviation => $"{prefix}{unitAbbreviation}").ToArray();
+
+ return new Localization { Culture = loc.Culture, Abbreviations = unitAbbreviationsForPrefix };
+ }).ToArray();
+ }
+}
diff --git a/CodeGen/JsonTypes/BaseDimensions.cs b/CodeGen/JsonTypes/BaseDimensions.cs
index a6caad21fd..59f9389505 100644
--- a/CodeGen/JsonTypes/BaseDimensions.cs
+++ b/CodeGen/JsonTypes/BaseDimensions.cs
@@ -1,6 +1,8 @@
-// Licensed under MIT No Attribution, see LICENSE file at the root.
+// Licensed under MIT No Attribution, see LICENSE file at the root.
// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
+using System.Text;
+
namespace CodeGen.JsonTypes
{
internal class BaseDimensions
@@ -25,5 +27,39 @@ internal class BaseDimensions
// 0649 Field is never assigned to
#pragma warning restore 0649
+
+
+ ///
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+
+ // There are many possible choices of base physical dimensions. The SI standard selects the following dimensions and corresponding dimension symbols:
+ // time (T), length (L), mass (M), electric current (I), absolute temperature (Θ), amount of substance (N) and luminous intensity (J).
+ AppendDimensionString(sb, "T", T);
+ AppendDimensionString(sb, "L", L);
+ AppendDimensionString(sb, "M", M);
+ AppendDimensionString(sb, "I", I);
+ AppendDimensionString(sb, "Θ", Θ);
+ AppendDimensionString(sb, "N", N);
+ AppendDimensionString(sb, "J", J);
+
+ return sb.ToString();
+ }
+
+ private static void AppendDimensionString(StringBuilder sb, string name, int value)
+ {
+ switch (value)
+ {
+ case 0:
+ return;
+ case 1:
+ sb.AppendFormat("[{0}]", name);
+ break;
+ default:
+ sb.AppendFormat("[{0}^{1}]", name, value);
+ break;
+ }
+ }
}
}
diff --git a/CodeGen/JsonTypes/BaseUnits.cs b/CodeGen/JsonTypes/BaseUnits.cs
index d40b54dfeb..ff97054764 100644
--- a/CodeGen/JsonTypes/BaseUnits.cs
+++ b/CodeGen/JsonTypes/BaseUnits.cs
@@ -1,6 +1,9 @@
// Licensed under MIT No Attribution, see LICENSE file at the root.
// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
+using System;
+using System.Text;
+
namespace CodeGen.JsonTypes
{
internal class BaseUnits
@@ -25,5 +28,34 @@ internal class BaseUnits
// 0649 Field is never assigned to
#pragma warning restore 0649
+
+ ///
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+ if (N is { } n) sb.Append($"N={n}, ");
+ if (I is { } i) sb.Append($"I={i}, ");
+ if (L is { } l) sb.Append($"L={l}, ");
+ if (J is { } j) sb.Append($"J={j}, ");
+ if (M is { } m) sb.Append($"M={m}, ");
+ if (Θ is { } θ) sb.Append($"Θ={θ}, ");
+ if (T is { } t) sb.Append($"T={t}, ");
+
+ return sb.ToString().TrimEnd(' ', ',');
+ }
+
+ public BaseUnits Clone()
+ {
+ return new BaseUnits
+ {
+ N = N,
+ I = I,
+ L = L,
+ J = J,
+ M = M,
+ Θ = Θ,
+ T = T
+ };
+ }
}
}
diff --git a/CodeGen/JsonTypes/Quantity.cs b/CodeGen/JsonTypes/Quantity.cs
index 35f81a3ee2..f471225ad8 100644
--- a/CodeGen/JsonTypes/Quantity.cs
+++ b/CodeGen/JsonTypes/Quantity.cs
@@ -2,9 +2,11 @@
// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
using System;
+using System.Diagnostics;
namespace CodeGen.JsonTypes
{
+ [DebuggerDisplay("{Name}")]
internal record Quantity
{
// 0649 Field is never assigned to
diff --git a/CodeGen/JsonTypes/Unit.cs b/CodeGen/JsonTypes/Unit.cs
index 4a775c08f9..982dd5a887 100644
--- a/CodeGen/JsonTypes/Unit.cs
+++ b/CodeGen/JsonTypes/Unit.cs
@@ -2,9 +2,11 @@
// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
using System;
+using System.Diagnostics;
namespace CodeGen.JsonTypes
{
+ [DebuggerDisplay("{SingularName})")]
internal class Unit
{
// 0649 Field is never assigned to
diff --git a/UnitsNet.Tests/CustomCode/DensityTests.cs b/UnitsNet.Tests/CustomCode/DensityTests.cs
index b0a1930560..70e562d9c1 100644
--- a/UnitsNet.Tests/CustomCode/DensityTests.cs
+++ b/UnitsNet.Tests/CustomCode/DensityTests.cs
@@ -121,30 +121,6 @@ public class DensityTests : DensityTestsBase
protected override double SlugsPerCubicInchInOneKilogramPerCubicMeter => 1.1228705576569e-6;
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits()
- {
- base.Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void BaseUnit_HasSIBase()
- {
- base.BaseUnit_HasSIBase();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void As_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.As_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
-
[Fact]
public static void DensityTimesVolumeEqualsMass()
{
diff --git a/UnitsNet.Tests/CustomCode/LinearDensityTests.cs b/UnitsNet.Tests/CustomCode/LinearDensityTests.cs
index e6f8c9bcb0..23483d2153 100644
--- a/UnitsNet.Tests/CustomCode/LinearDensityTests.cs
+++ b/UnitsNet.Tests/CustomCode/LinearDensityTests.cs
@@ -55,30 +55,6 @@ public class LinearDensityTests : LinearDensityTestsBase
protected override double PoundsPerFootInOneKilogramPerMeter => 6.71968975e-1;
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits()
- {
- base.Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void BaseUnit_HasSIBase()
- {
- base.BaseUnit_HasSIBase();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void As_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.As_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
-
[Fact]
public void LinearDensityDividedByAreaEqualsDensity()
{
diff --git a/UnitsNet.Tests/CustomCode/MassConcentrationTests.cs b/UnitsNet.Tests/CustomCode/MassConcentrationTests.cs
index 7188938fda..6c741f4e0e 100644
--- a/UnitsNet.Tests/CustomCode/MassConcentrationTests.cs
+++ b/UnitsNet.Tests/CustomCode/MassConcentrationTests.cs
@@ -85,30 +85,6 @@ public class MassConcentrationTests : MassConcentrationTestsBase
protected override double OuncesPerUSGallonInOneKilogramPerCubicMeter => 0.1335264711843;
#endregion
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits()
- {
- base.Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void BaseUnit_HasSIBase()
- {
- base.BaseUnit_HasSIBase();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void As_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.As_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
-
[Theory]
[InlineData(60.02, MassConcentrationUnit.KilogramPerCubicMeter,
58.443, MolarMassUnit.GramPerMole,
@@ -160,14 +136,6 @@ public static void ComponentMassFromMassConcentrationAndSolutionVolume(
AssertEx.EqualTolerance(expectedMassValue, massComponent.As(expectedMassUnit), tolerance);
}
- [Fact(Skip = "No BaseUnit defined: see https://github.com/angularsen/UnitsNet/issues/651")]
- public void DefaultSIUnitIsKgPerCubicMeter()
- {
- var massConcentration = new MassConcentration(1, UnitSystem.SI);
-
- Assert.Equal(MassConcentrationUnit.KilogramPerCubicMeter, massConcentration.Unit); // MassConcentration.BaseUnit = KilogramPerCubicMeter
- }
-
[Fact]
public void DefaultUnitTypeRespectedForCustomUnitSystem()
{
diff --git a/UnitsNet.Tests/CustomCode/MassFlowTests.cs b/UnitsNet.Tests/CustomCode/MassFlowTests.cs
index 1b39b49b56..70d9da35a9 100644
--- a/UnitsNet.Tests/CustomCode/MassFlowTests.cs
+++ b/UnitsNet.Tests/CustomCode/MassFlowTests.cs
@@ -75,30 +75,12 @@ public class MassFlowTests : MassFlowTestsBase
protected override double PoundsPerDayInOneGramPerSecond => 1.9047936e2;
protected override double GramsPerHourInOneGramPerSecond => 3600;
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits()
- {
- base.Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits();
- }
[Fact(Skip = "See about changing the BaseUnit to KilogramPerSecond")]
public override void BaseUnit_HasSIBase()
{
base.BaseUnit_HasSIBase();
}
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void As_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.As_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
[Fact]
public void DurationTimesMassFlowEqualsMass()
diff --git a/UnitsNet.Tests/CustomCode/MassFluxTests.cs b/UnitsNet.Tests/CustomCode/MassFluxTests.cs
index 8be8889443..7638abc52e 100644
--- a/UnitsNet.Tests/CustomCode/MassFluxTests.cs
+++ b/UnitsNet.Tests/CustomCode/MassFluxTests.cs
@@ -43,30 +43,6 @@ public class MassFluxTests : MassFluxTestsBase
protected override double KilogramsPerHourPerSquareCentimeterInOneKilogramPerSecondPerSquareMeter => 3.6E-1;
protected override double KilogramsPerHourPerSquareMillimeterInOneKilogramPerSecondPerSquareMeter => 3.6E-3;
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits()
- {
- base.Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void BaseUnit_HasSIBase()
- {
- base.BaseUnit_HasSIBase();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void As_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.As_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
-
[Fact]
public void MassFluxDividedBySpeedEqualsDensity()
{
diff --git a/UnitsNet.Tests/CustomCode/MassMomentOfInertiaTests.cs b/UnitsNet.Tests/CustomCode/MassMomentOfInertiaTests.cs
index 6fbe339704..f1004c110e 100644
--- a/UnitsNet.Tests/CustomCode/MassMomentOfInertiaTests.cs
+++ b/UnitsNet.Tests/CustomCode/MassMomentOfInertiaTests.cs
@@ -85,29 +85,5 @@ public class MassMomentOfInertiaTests : MassMomentOfInertiaTestsBase
protected override double TonneSquareMetersInOneKilogramSquareMeter => 1e-3;
protected override double TonneSquareMilimetersInOneKilogramSquareMeter => 1e3;
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits()
- {
- base.Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void BaseUnit_HasSIBase()
- {
- base.BaseUnit_HasSIBase();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void As_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.As_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
}
}
diff --git a/UnitsNet.Tests/CustomCode/MassTests.cs b/UnitsNet.Tests/CustomCode/MassTests.cs
index 7cdb4b9918..432aef8029 100644
--- a/UnitsNet.Tests/CustomCode/MassTests.cs
+++ b/UnitsNet.Tests/CustomCode/MassTests.cs
@@ -66,31 +66,7 @@ public class MassTests : MassTestsBase
protected override double FemtogramsInOneKilogram => 1E18;
protected override double PicogramsInOneKilogram => 1E15;
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits()
- {
- base.Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void BaseUnit_HasSIBase()
- {
- base.BaseUnit_HasSIBase();
- }
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void As_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.As_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
-
[Fact]
public void AccelerationTimesMassEqualsForce()
{
diff --git a/UnitsNet.Tests/CustomCode/MolarMassTests.cs b/UnitsNet.Tests/CustomCode/MolarMassTests.cs
index 964dccf220..e48321fd36 100644
--- a/UnitsNet.Tests/CustomCode/MolarMassTests.cs
+++ b/UnitsNet.Tests/CustomCode/MolarMassTests.cs
@@ -44,30 +44,6 @@ public class MolarMassTests : MolarMassTestsBase
protected override double PoundsPerMoleInOneKilogramPerMole => 2.2046226218487757;
protected override double KilogramsPerKilomoleInOneKilogramPerMole => 1e3;
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits()
- {
- base.Ctor_SIUnitSystem_ReturnsQuantityWithSIUnits();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void BaseUnit_HasSIBase()
- {
- base.BaseUnit_HasSIBase();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void As_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.As_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
-
- [Fact(Skip = "The BaseUnits are not yet supported by the prefix-generator")]
- public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
-
[Fact]
public void MolarMassTimesAmountOfSubstanceEqualsMass()
{
diff --git a/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs b/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs
index dab2e7311f..6526699053 100644
--- a/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs
@@ -76,22 +76,22 @@ static AbsorbedDoseOfIonizingRadiation()
Info = new QuantityInfo("AbsorbedDoseOfIonizingRadiation",
new UnitInfo[]
{
- new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Centigray, "Centigrays", BaseUnits.Undefined, "AbsorbedDoseOfIonizingRadiation"),
+ new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Centigray, "Centigrays", new BaseUnits(length: LengthUnit.Decimeter, time: DurationUnit.Second), "AbsorbedDoseOfIonizingRadiation"),
new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Femtogray, "Femtograys", BaseUnits.Undefined, "AbsorbedDoseOfIonizingRadiation"),
new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Gigagray, "Gigagrays", BaseUnits.Undefined, "AbsorbedDoseOfIonizingRadiation"),
new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Gray, "Grays", new BaseUnits(length: LengthUnit.Meter, time: DurationUnit.Second), "AbsorbedDoseOfIonizingRadiation"),
new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Kilogray, "Kilograys", BaseUnits.Undefined, "AbsorbedDoseOfIonizingRadiation"),
new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Kilorad, "Kilorads", BaseUnits.Undefined, "AbsorbedDoseOfIonizingRadiation"),
- new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Megagray, "Megagrays", BaseUnits.Undefined, "AbsorbedDoseOfIonizingRadiation"),
+ new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Megagray, "Megagrays", new BaseUnits(length: LengthUnit.Kilometer, time: DurationUnit.Second), "AbsorbedDoseOfIonizingRadiation"),
new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Megarad, "Megarads", BaseUnits.Undefined, "AbsorbedDoseOfIonizingRadiation"),
- new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Microgray, "Micrograys", BaseUnits.Undefined, "AbsorbedDoseOfIonizingRadiation"),
+ new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Microgray, "Micrograys", new BaseUnits(length: LengthUnit.Millimeter, time: DurationUnit.Second), "AbsorbedDoseOfIonizingRadiation"),
new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Milligray, "Milligrays", BaseUnits.Undefined, "AbsorbedDoseOfIonizingRadiation"),
new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Millirad, "Millirads", BaseUnits.Undefined, "AbsorbedDoseOfIonizingRadiation"),
new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Nanogray, "Nanograys", BaseUnits.Undefined, "AbsorbedDoseOfIonizingRadiation"),
new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Petagray, "Petagrays", BaseUnits.Undefined, "AbsorbedDoseOfIonizingRadiation"),
- new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Picogray, "Picograys", BaseUnits.Undefined, "AbsorbedDoseOfIonizingRadiation"),
+ new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Picogray, "Picograys", new BaseUnits(length: LengthUnit.Micrometer, time: DurationUnit.Second), "AbsorbedDoseOfIonizingRadiation"),
new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Rad, "Rads", BaseUnits.Undefined, "AbsorbedDoseOfIonizingRadiation"),
- new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Teragray, "Teragrays", BaseUnits.Undefined, "AbsorbedDoseOfIonizingRadiation"),
+ new UnitInfo(AbsorbedDoseOfIonizingRadiationUnit.Teragray, "Teragrays", new BaseUnits(length: LengthUnit.Megameter, time: DurationUnit.Second), "AbsorbedDoseOfIonizingRadiation"),
},
BaseUnit, Zero, BaseDimensions);
diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs
index 95d11a0367..ad1da365ae 100644
--- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs
@@ -80,19 +80,19 @@ static Acceleration()
Info = new QuantityInfo("Acceleration",
new UnitInfo[]
{
- new UnitInfo(AccelerationUnit.CentimeterPerSecondSquared, "CentimetersPerSecondSquared", BaseUnits.Undefined, "Acceleration"),
- new UnitInfo(AccelerationUnit.DecimeterPerSecondSquared, "DecimetersPerSecondSquared", BaseUnits.Undefined, "Acceleration"),
+ new UnitInfo(AccelerationUnit.CentimeterPerSecondSquared, "CentimetersPerSecondSquared", new BaseUnits(length: LengthUnit.Centimeter, time: DurationUnit.Second), "Acceleration"),
+ new UnitInfo(AccelerationUnit.DecimeterPerSecondSquared, "DecimetersPerSecondSquared", new BaseUnits(length: LengthUnit.Decimeter, time: DurationUnit.Second), "Acceleration"),
new UnitInfo(AccelerationUnit.FootPerSecondSquared, "FeetPerSecondSquared", new BaseUnits(length: LengthUnit.Foot, time: DurationUnit.Second), "Acceleration"),
new UnitInfo(AccelerationUnit.InchPerSecondSquared, "InchesPerSecondSquared", new BaseUnits(length: LengthUnit.Inch, time: DurationUnit.Second), "Acceleration"),
- new UnitInfo(AccelerationUnit.KilometerPerSecondSquared, "KilometersPerSecondSquared", BaseUnits.Undefined, "Acceleration"),
+ new UnitInfo(AccelerationUnit.KilometerPerSecondSquared, "KilometersPerSecondSquared", new BaseUnits(length: LengthUnit.Kilometer, time: DurationUnit.Second), "Acceleration"),
new UnitInfo(AccelerationUnit.KnotPerHour, "KnotsPerHour", new BaseUnits(length: LengthUnit.NauticalMile, time: DurationUnit.Hour), "Acceleration"),
new UnitInfo(AccelerationUnit.KnotPerMinute, "KnotsPerMinute", new BaseUnits(length: LengthUnit.NauticalMile, time: DurationUnit.Minute), "Acceleration"),
new UnitInfo(AccelerationUnit.KnotPerSecond, "KnotsPerSecond", new BaseUnits(length: LengthUnit.NauticalMile, time: DurationUnit.Second), "Acceleration"),
new UnitInfo(AccelerationUnit.MeterPerSecondSquared, "MetersPerSecondSquared", new BaseUnits(length: LengthUnit.Meter, time: DurationUnit.Second), "Acceleration"),
- new UnitInfo(AccelerationUnit.MicrometerPerSecondSquared, "MicrometersPerSecondSquared", BaseUnits.Undefined, "Acceleration"),
- new UnitInfo(AccelerationUnit.MillimeterPerSecondSquared, "MillimetersPerSecondSquared", BaseUnits.Undefined, "Acceleration"),
- new UnitInfo(AccelerationUnit.MillistandardGravity, "MillistandardGravity", BaseUnits.Undefined, "Acceleration"),
- new UnitInfo(AccelerationUnit.NanometerPerSecondSquared, "NanometersPerSecondSquared", BaseUnits.Undefined, "Acceleration"),
+ new UnitInfo(AccelerationUnit.MicrometerPerSecondSquared, "MicrometersPerSecondSquared", new BaseUnits(length: LengthUnit.Micrometer, time: DurationUnit.Second), "Acceleration"),
+ new UnitInfo(AccelerationUnit.MillimeterPerSecondSquared, "MillimetersPerSecondSquared", new BaseUnits(length: LengthUnit.Millimeter, time: DurationUnit.Second), "Acceleration"),
+ new UnitInfo(AccelerationUnit.MillistandardGravity, "MillistandardGravity", new BaseUnits(length: LengthUnit.Millimeter, time: DurationUnit.Second), "Acceleration"),
+ new UnitInfo(AccelerationUnit.NanometerPerSecondSquared, "NanometersPerSecondSquared", new BaseUnits(length: LengthUnit.Nanometer, time: DurationUnit.Second), "Acceleration"),
new UnitInfo(AccelerationUnit.StandardGravity, "StandardGravity", new BaseUnits(length: LengthUnit.Meter, time: DurationUnit.Second), "Acceleration"),
},
BaseUnit, Zero, BaseDimensions);
diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs
index 397deaaa79..70442d991c 100644
--- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs
@@ -81,22 +81,22 @@ static AmountOfSubstance()
Info = new QuantityInfo("AmountOfSubstance",
new UnitInfo[]
{
- new UnitInfo(AmountOfSubstanceUnit.Centimole, "Centimoles", BaseUnits.Undefined, "AmountOfSubstance"),
- new UnitInfo(AmountOfSubstanceUnit.CentipoundMole, "CentipoundMoles", BaseUnits.Undefined, "AmountOfSubstance"),
- new UnitInfo(AmountOfSubstanceUnit.Decimole, "Decimoles", BaseUnits.Undefined, "AmountOfSubstance"),
- new UnitInfo(AmountOfSubstanceUnit.DecipoundMole, "DecipoundMoles", BaseUnits.Undefined, "AmountOfSubstance"),
- new UnitInfo(AmountOfSubstanceUnit.Femtomole, "Femtomoles", BaseUnits.Undefined, "AmountOfSubstance"),
- new UnitInfo(AmountOfSubstanceUnit.Kilomole, "Kilomoles", BaseUnits.Undefined, "AmountOfSubstance"),
- new UnitInfo(AmountOfSubstanceUnit.KilopoundMole, "KilopoundMoles", BaseUnits.Undefined, "AmountOfSubstance"),
- new UnitInfo(AmountOfSubstanceUnit.Megamole, "Megamoles", BaseUnits.Undefined, "AmountOfSubstance"),
- new UnitInfo(AmountOfSubstanceUnit.Micromole, "Micromoles", BaseUnits.Undefined, "AmountOfSubstance"),
- new UnitInfo(AmountOfSubstanceUnit.MicropoundMole, "MicropoundMoles", BaseUnits.Undefined, "AmountOfSubstance"),
- new UnitInfo(AmountOfSubstanceUnit.Millimole, "Millimoles", BaseUnits.Undefined, "AmountOfSubstance"),
- new UnitInfo(AmountOfSubstanceUnit.MillipoundMole, "MillipoundMoles", BaseUnits.Undefined, "AmountOfSubstance"),
+ new UnitInfo(AmountOfSubstanceUnit.Centimole, "Centimoles", new BaseUnits(amount: AmountOfSubstanceUnit.Centimole), "AmountOfSubstance"),
+ new UnitInfo(AmountOfSubstanceUnit.CentipoundMole, "CentipoundMoles", new BaseUnits(amount: AmountOfSubstanceUnit.CentipoundMole), "AmountOfSubstance"),
+ new UnitInfo(AmountOfSubstanceUnit.Decimole, "Decimoles", new BaseUnits(amount: AmountOfSubstanceUnit.Decimole), "AmountOfSubstance"),
+ new UnitInfo(AmountOfSubstanceUnit.DecipoundMole, "DecipoundMoles", new BaseUnits(amount: AmountOfSubstanceUnit.DecipoundMole), "AmountOfSubstance"),
+ new UnitInfo(AmountOfSubstanceUnit.Femtomole, "Femtomoles", new BaseUnits(amount: AmountOfSubstanceUnit.Femtomole), "AmountOfSubstance"),
+ new UnitInfo(AmountOfSubstanceUnit.Kilomole, "Kilomoles", new BaseUnits(amount: AmountOfSubstanceUnit.Kilomole), "AmountOfSubstance"),
+ new UnitInfo(AmountOfSubstanceUnit.KilopoundMole, "KilopoundMoles", new BaseUnits(amount: AmountOfSubstanceUnit.KilopoundMole), "AmountOfSubstance"),
+ new UnitInfo(AmountOfSubstanceUnit.Megamole, "Megamoles", new BaseUnits(amount: AmountOfSubstanceUnit.Megamole), "AmountOfSubstance"),
+ new UnitInfo(AmountOfSubstanceUnit.Micromole, "Micromoles", new BaseUnits(amount: AmountOfSubstanceUnit.Micromole), "AmountOfSubstance"),
+ new UnitInfo(AmountOfSubstanceUnit.MicropoundMole, "MicropoundMoles", new BaseUnits(amount: AmountOfSubstanceUnit.MicropoundMole), "AmountOfSubstance"),
+ new UnitInfo(AmountOfSubstanceUnit.Millimole, "Millimoles", new BaseUnits(amount: AmountOfSubstanceUnit.Millimole), "AmountOfSubstance"),
+ new UnitInfo(AmountOfSubstanceUnit.MillipoundMole, "MillipoundMoles", new BaseUnits(amount: AmountOfSubstanceUnit.MillipoundMole), "AmountOfSubstance"),
new UnitInfo(AmountOfSubstanceUnit.Mole, "Moles", new BaseUnits(amount: AmountOfSubstanceUnit.Mole), "AmountOfSubstance"),
- new UnitInfo(AmountOfSubstanceUnit.Nanomole, "Nanomoles", BaseUnits.Undefined, "AmountOfSubstance"),
- new UnitInfo(AmountOfSubstanceUnit.NanopoundMole, "NanopoundMoles", BaseUnits.Undefined, "AmountOfSubstance"),
- new UnitInfo(AmountOfSubstanceUnit.Picomole, "Picomoles", BaseUnits.Undefined, "AmountOfSubstance"),
+ new UnitInfo(AmountOfSubstanceUnit.Nanomole, "Nanomoles", new BaseUnits(amount: AmountOfSubstanceUnit.Nanomole), "AmountOfSubstance"),
+ new UnitInfo(AmountOfSubstanceUnit.NanopoundMole, "NanopoundMoles", new BaseUnits(amount: AmountOfSubstanceUnit.NanopoundMole), "AmountOfSubstance"),
+ new UnitInfo(AmountOfSubstanceUnit.Picomole, "Picomoles", new BaseUnits(amount: AmountOfSubstanceUnit.Picomole), "AmountOfSubstance"),
new UnitInfo(AmountOfSubstanceUnit.PoundMole, "PoundMoles", new BaseUnits(amount: AmountOfSubstanceUnit.PoundMole), "AmountOfSubstance"),
},
BaseUnit, Zero, BaseDimensions);
diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs
index 8fc235a9ee..f073a23c80 100644
--- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs
@@ -84,15 +84,15 @@ static BitRate()
new UnitInfo(BitRateUnit.ExbibytePerSecond, "ExbibytesPerSecond", BaseUnits.Undefined, "BitRate"),
new UnitInfo(BitRateUnit.GibibitPerSecond, "GibibitsPerSecond", BaseUnits.Undefined, "BitRate"),
new UnitInfo(BitRateUnit.GibibytePerSecond, "GibibytesPerSecond", BaseUnits.Undefined, "BitRate"),
- new UnitInfo(BitRateUnit.GigabitPerSecond, "GigabitsPerSecond", BaseUnits.Undefined, "BitRate"),
+ new UnitInfo(BitRateUnit.GigabitPerSecond, "GigabitsPerSecond", new BaseUnits(time: DurationUnit.Nanosecond), "BitRate"),
new UnitInfo(BitRateUnit.GigabytePerSecond, "GigabytesPerSecond", BaseUnits.Undefined, "BitRate"),
new UnitInfo(BitRateUnit.KibibitPerSecond, "KibibitsPerSecond", BaseUnits.Undefined, "BitRate"),
new UnitInfo(BitRateUnit.KibibytePerSecond, "KibibytesPerSecond", BaseUnits.Undefined, "BitRate"),
- new UnitInfo(BitRateUnit.KilobitPerSecond, "KilobitsPerSecond", BaseUnits.Undefined, "BitRate"),
+ new UnitInfo(BitRateUnit.KilobitPerSecond, "KilobitsPerSecond", new BaseUnits(time: DurationUnit.Millisecond), "BitRate"),
new UnitInfo(BitRateUnit.KilobytePerSecond, "KilobytesPerSecond", BaseUnits.Undefined, "BitRate"),
new UnitInfo(BitRateUnit.MebibitPerSecond, "MebibitsPerSecond", BaseUnits.Undefined, "BitRate"),
new UnitInfo(BitRateUnit.MebibytePerSecond, "MebibytesPerSecond", BaseUnits.Undefined, "BitRate"),
- new UnitInfo(BitRateUnit.MegabitPerSecond, "MegabitsPerSecond", BaseUnits.Undefined, "BitRate"),
+ new UnitInfo(BitRateUnit.MegabitPerSecond, "MegabitsPerSecond", new BaseUnits(time: DurationUnit.Microsecond), "BitRate"),
new UnitInfo(BitRateUnit.MegabytePerSecond, "MegabytesPerSecond", BaseUnits.Undefined, "BitRate"),
new UnitInfo(BitRateUnit.PebibitPerSecond, "PebibitsPerSecond", BaseUnits.Undefined, "BitRate"),
new UnitInfo(BitRateUnit.PebibytePerSecond, "PebibytesPerSecond", BaseUnits.Undefined, "BitRate"),
diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs
index cb0a35ea54..b043c3f7e9 100644
--- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs
@@ -86,14 +86,14 @@ static Density()
new UnitInfo[]
{
new UnitInfo(DensityUnit.CentigramPerDeciliter, "CentigramsPerDeciliter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.CentigramPerLiter, "CentigramsPerLiter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.CentigramPerMilliliter, "CentigramsPerMilliliter", BaseUnits.Undefined, "Density"),
+ new UnitInfo(DensityUnit.CentigramPerLiter, "CentigramsPerLiter", new BaseUnits(length: LengthUnit.Decimeter, mass: MassUnit.Centigram), "Density"),
+ new UnitInfo(DensityUnit.CentigramPerMilliliter, "CentigramsPerMilliliter", new BaseUnits(length: LengthUnit.Centimeter, mass: MassUnit.Centigram), "Density"),
new UnitInfo(DensityUnit.DecigramPerDeciliter, "DecigramsPerDeciliter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.DecigramPerLiter, "DecigramsPerLiter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.DecigramPerMilliliter, "DecigramsPerMilliliter", BaseUnits.Undefined, "Density"),
+ new UnitInfo(DensityUnit.DecigramPerLiter, "DecigramsPerLiter", new BaseUnits(length: LengthUnit.Decimeter, mass: MassUnit.Decigram), "Density"),
+ new UnitInfo(DensityUnit.DecigramPerMilliliter, "DecigramsPerMilliliter", new BaseUnits(length: LengthUnit.Centimeter, mass: MassUnit.Decigram), "Density"),
new UnitInfo(DensityUnit.FemtogramPerDeciliter, "FemtogramsPerDeciliter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.FemtogramPerLiter, "FemtogramsPerLiter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.FemtogramPerMilliliter, "FemtogramsPerMilliliter", BaseUnits.Undefined, "Density"),
+ new UnitInfo(DensityUnit.FemtogramPerLiter, "FemtogramsPerLiter", new BaseUnits(length: LengthUnit.Decimeter, mass: MassUnit.Femtogram), "Density"),
+ new UnitInfo(DensityUnit.FemtogramPerMilliliter, "FemtogramsPerMilliliter", new BaseUnits(length: LengthUnit.Centimeter, mass: MassUnit.Femtogram), "Density"),
new UnitInfo(DensityUnit.GramPerCubicCentimeter, "GramsPerCubicCentimeter", new BaseUnits(length: LengthUnit.Centimeter, mass: MassUnit.Gram), "Density"),
new UnitInfo(DensityUnit.GramPerCubicFoot, "GramsPerCubicFoot", new BaseUnits(length: LengthUnit.Foot, mass: MassUnit.Gram), "Density"),
new UnitInfo(DensityUnit.GramPerCubicInch, "GramsPerCubicInch", new BaseUnits(length: LengthUnit.Inch, mass: MassUnit.Gram), "Density"),
@@ -102,27 +102,27 @@ static Density()
new UnitInfo(DensityUnit.GramPerDeciliter, "GramsPerDeciliter", BaseUnits.Undefined, "Density"),
new UnitInfo(DensityUnit.GramPerLiter, "GramsPerLiter", new BaseUnits(length: LengthUnit.Decimeter, mass: MassUnit.Gram), "Density"),
new UnitInfo(DensityUnit.GramPerMilliliter, "GramsPerMilliliter", new BaseUnits(length: LengthUnit.Centimeter, mass: MassUnit.Gram), "Density"),
- new UnitInfo(DensityUnit.KilogramPerCubicCentimeter, "KilogramsPerCubicCentimeter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.KilogramPerCubicMeter, "KilogramsPerCubicMeter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.KilogramPerCubicMillimeter, "KilogramsPerCubicMillimeter", BaseUnits.Undefined, "Density"),
+ new UnitInfo(DensityUnit.KilogramPerCubicCentimeter, "KilogramsPerCubicCentimeter", new BaseUnits(length: LengthUnit.Centimeter, mass: MassUnit.Kilogram), "Density"),
+ new UnitInfo(DensityUnit.KilogramPerCubicMeter, "KilogramsPerCubicMeter", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram), "Density"),
+ new UnitInfo(DensityUnit.KilogramPerCubicMillimeter, "KilogramsPerCubicMillimeter", new BaseUnits(length: LengthUnit.Millimeter, mass: MassUnit.Kilogram), "Density"),
new UnitInfo(DensityUnit.KilogramPerLiter, "KilogramsPerLiter", new BaseUnits(length: LengthUnit.Decimeter, mass: MassUnit.Kilogram), "Density"),
- new UnitInfo(DensityUnit.KilopoundPerCubicFoot, "KilopoundsPerCubicFoot", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.KilopoundPerCubicInch, "KilopoundsPerCubicInch", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.KilopoundPerCubicYard, "KilopoundsPerCubicYard", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.MicrogramPerCubicMeter, "MicrogramsPerCubicMeter", BaseUnits.Undefined, "Density"),
+ new UnitInfo(DensityUnit.KilopoundPerCubicFoot, "KilopoundsPerCubicFoot", new BaseUnits(length: LengthUnit.Foot, mass: MassUnit.Kilopound), "Density"),
+ new UnitInfo(DensityUnit.KilopoundPerCubicInch, "KilopoundsPerCubicInch", new BaseUnits(length: LengthUnit.Inch, mass: MassUnit.Kilopound), "Density"),
+ new UnitInfo(DensityUnit.KilopoundPerCubicYard, "KilopoundsPerCubicYard", new BaseUnits(length: LengthUnit.Yard, mass: MassUnit.Kilopound), "Density"),
+ new UnitInfo(DensityUnit.MicrogramPerCubicMeter, "MicrogramsPerCubicMeter", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Microgram), "Density"),
new UnitInfo(DensityUnit.MicrogramPerDeciliter, "MicrogramsPerDeciliter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.MicrogramPerLiter, "MicrogramsPerLiter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.MicrogramPerMilliliter, "MicrogramsPerMilliliter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.MilligramPerCubicMeter, "MilligramsPerCubicMeter", BaseUnits.Undefined, "Density"),
+ new UnitInfo(DensityUnit.MicrogramPerLiter, "MicrogramsPerLiter", new BaseUnits(length: LengthUnit.Decimeter, mass: MassUnit.Microgram), "Density"),
+ new UnitInfo(DensityUnit.MicrogramPerMilliliter, "MicrogramsPerMilliliter", new BaseUnits(length: LengthUnit.Centimeter, mass: MassUnit.Microgram), "Density"),
+ new UnitInfo(DensityUnit.MilligramPerCubicMeter, "MilligramsPerCubicMeter", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Milligram), "Density"),
new UnitInfo(DensityUnit.MilligramPerDeciliter, "MilligramsPerDeciliter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.MilligramPerLiter, "MilligramsPerLiter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.MilligramPerMilliliter, "MilligramsPerMilliliter", BaseUnits.Undefined, "Density"),
+ new UnitInfo(DensityUnit.MilligramPerLiter, "MilligramsPerLiter", new BaseUnits(length: LengthUnit.Decimeter, mass: MassUnit.Milligram), "Density"),
+ new UnitInfo(DensityUnit.MilligramPerMilliliter, "MilligramsPerMilliliter", new BaseUnits(length: LengthUnit.Centimeter, mass: MassUnit.Milligram), "Density"),
new UnitInfo(DensityUnit.NanogramPerDeciliter, "NanogramsPerDeciliter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.NanogramPerLiter, "NanogramsPerLiter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.NanogramPerMilliliter, "NanogramsPerMilliliter", BaseUnits.Undefined, "Density"),
+ new UnitInfo(DensityUnit.NanogramPerLiter, "NanogramsPerLiter", new BaseUnits(length: LengthUnit.Decimeter, mass: MassUnit.Nanogram), "Density"),
+ new UnitInfo(DensityUnit.NanogramPerMilliliter, "NanogramsPerMilliliter", new BaseUnits(length: LengthUnit.Centimeter, mass: MassUnit.Nanogram), "Density"),
new UnitInfo(DensityUnit.PicogramPerDeciliter, "PicogramsPerDeciliter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.PicogramPerLiter, "PicogramsPerLiter", BaseUnits.Undefined, "Density"),
- new UnitInfo(DensityUnit.PicogramPerMilliliter, "PicogramsPerMilliliter", BaseUnits.Undefined, "Density"),
+ new UnitInfo(DensityUnit.PicogramPerLiter, "PicogramsPerLiter", new BaseUnits(length: LengthUnit.Decimeter, mass: MassUnit.Picogram), "Density"),
+ new UnitInfo(DensityUnit.PicogramPerMilliliter, "PicogramsPerMilliliter", new BaseUnits(length: LengthUnit.Centimeter, mass: MassUnit.Picogram), "Density"),
new UnitInfo(DensityUnit.PoundPerCubicCentimeter, "PoundsPerCubicCentimeter", new BaseUnits(length: LengthUnit.Centimeter, mass: MassUnit.Pound), "Density"),
new UnitInfo(DensityUnit.PoundPerCubicFoot, "PoundsPerCubicFoot", new BaseUnits(length: LengthUnit.Foot, mass: MassUnit.Pound), "Density"),
new UnitInfo(DensityUnit.PoundPerCubicInch, "PoundsPerCubicInch", new BaseUnits(length: LengthUnit.Inch, mass: MassUnit.Pound), "Density"),
diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs
index 7294093924..56545f36f8 100644
--- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs
@@ -93,11 +93,11 @@ static Duration()
new UnitInfo(DurationUnit.Day, "Days", new BaseUnits(time: DurationUnit.Day), "Duration"),
new UnitInfo(DurationUnit.Hour, "Hours", new BaseUnits(time: DurationUnit.Hour), "Duration"),
new UnitInfo(DurationUnit.JulianYear, "JulianYears", new BaseUnits(time: DurationUnit.JulianYear), "Duration"),
- new UnitInfo(DurationUnit.Microsecond, "Microseconds", BaseUnits.Undefined, "Duration"),
- new UnitInfo(DurationUnit.Millisecond, "Milliseconds", BaseUnits.Undefined, "Duration"),
+ new UnitInfo(DurationUnit.Microsecond, "Microseconds", new BaseUnits(time: DurationUnit.Microsecond), "Duration"),
+ new UnitInfo(DurationUnit.Millisecond, "Milliseconds", new BaseUnits(time: DurationUnit.Millisecond), "Duration"),
new UnitInfo(DurationUnit.Minute, "Minutes", new BaseUnits(time: DurationUnit.Minute), "Duration"),
new UnitInfo(DurationUnit.Month30, "Months30", new BaseUnits(time: DurationUnit.Month30), "Duration"),
- new UnitInfo(DurationUnit.Nanosecond, "Nanoseconds", BaseUnits.Undefined, "Duration"),
+ new UnitInfo(DurationUnit.Nanosecond, "Nanoseconds", new BaseUnits(time: DurationUnit.Nanosecond), "Duration"),
new UnitInfo(DurationUnit.Second, "Seconds", new BaseUnits(time: DurationUnit.Second), "Duration"),
new UnitInfo(DurationUnit.Sol, "Sols", new BaseUnits(time: DurationUnit.Sol), "Duration"),
new UnitInfo(DurationUnit.Week, "Weeks", new BaseUnits(time: DurationUnit.Week), "Duration"),
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs
index 2123352cc3..f7ea3a76aa 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs
@@ -78,21 +78,21 @@ static ElectricAdmittance()
new UnitInfo[]
{
new UnitInfo(ElectricAdmittanceUnit.Gigamho, "Gigamhos", BaseUnits.Undefined, "ElectricAdmittance"),
- new UnitInfo(ElectricAdmittanceUnit.Gigasiemens, "Gigasiemens", BaseUnits.Undefined, "ElectricAdmittance"),
+ new UnitInfo(ElectricAdmittanceUnit.Gigasiemens, "Gigasiemens", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Microgram, time: DurationUnit.Second, current: ElectricCurrentUnit.Ampere), "ElectricAdmittance"),
new UnitInfo(ElectricAdmittanceUnit.Kilomho, "Kilomhos", BaseUnits.Undefined, "ElectricAdmittance"),
new UnitInfo(ElectricAdmittanceUnit.Kilosiemens, "Kilosiemens", BaseUnits.Undefined, "ElectricAdmittance"),
new UnitInfo(ElectricAdmittanceUnit.Megamho, "Megamhos", BaseUnits.Undefined, "ElectricAdmittance"),
- new UnitInfo(ElectricAdmittanceUnit.Megasiemens, "Megasiemens", BaseUnits.Undefined, "ElectricAdmittance"),
+ new UnitInfo(ElectricAdmittanceUnit.Megasiemens, "Megasiemens", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Milligram, time: DurationUnit.Second, current: ElectricCurrentUnit.Ampere), "ElectricAdmittance"),
new UnitInfo(ElectricAdmittanceUnit.Mho, "Mhos", BaseUnits.Undefined, "ElectricAdmittance"),
new UnitInfo(ElectricAdmittanceUnit.Micromho, "Micromhos", BaseUnits.Undefined, "ElectricAdmittance"),
- new UnitInfo(ElectricAdmittanceUnit.Microsiemens, "Microsiemens", BaseUnits.Undefined, "ElectricAdmittance"),
+ new UnitInfo(ElectricAdmittanceUnit.Microsiemens, "Microsiemens", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Second, current: ElectricCurrentUnit.Milliampere), "ElectricAdmittance"),
new UnitInfo(ElectricAdmittanceUnit.Millimho, "Millimhos", BaseUnits.Undefined, "ElectricAdmittance"),
new UnitInfo(ElectricAdmittanceUnit.Millisiemens, "Millisiemens", BaseUnits.Undefined, "ElectricAdmittance"),
new UnitInfo(ElectricAdmittanceUnit.Nanomho, "Nanomhos", BaseUnits.Undefined, "ElectricAdmittance"),
- new UnitInfo(ElectricAdmittanceUnit.Nanosiemens, "Nanosiemens", BaseUnits.Undefined, "ElectricAdmittance"),
+ new UnitInfo(ElectricAdmittanceUnit.Nanosiemens, "Nanosiemens", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Millisecond, current: ElectricCurrentUnit.Ampere), "ElectricAdmittance"),
new UnitInfo(ElectricAdmittanceUnit.Siemens, "Siemens", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Second, current: ElectricCurrentUnit.Ampere), "ElectricAdmittance"),
new UnitInfo(ElectricAdmittanceUnit.Teramho, "Teramhos", BaseUnits.Undefined, "ElectricAdmittance"),
- new UnitInfo(ElectricAdmittanceUnit.Terasiemens, "Terasiemens", BaseUnits.Undefined, "ElectricAdmittance"),
+ new UnitInfo(ElectricAdmittanceUnit.Terasiemens, "Terasiemens", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Nanogram, time: DurationUnit.Second, current: ElectricCurrentUnit.Ampere), "ElectricAdmittance"),
},
BaseUnit, Zero, BaseDimensions);
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs
index 3279c88039..ce9fc9ec78 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs
@@ -76,10 +76,10 @@ static ElectricApparentPower()
Info = new QuantityInfo("ElectricApparentPower",
new UnitInfo[]
{
- new UnitInfo(ElectricApparentPowerUnit.Gigavoltampere, "Gigavoltamperes", BaseUnits.Undefined, "ElectricApparentPower"),
+ new UnitInfo(ElectricApparentPowerUnit.Gigavoltampere, "Gigavoltamperes", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Millisecond), "ElectricApparentPower"),
new UnitInfo(ElectricApparentPowerUnit.Kilovoltampere, "Kilovoltamperes", BaseUnits.Undefined, "ElectricApparentPower"),
- new UnitInfo(ElectricApparentPowerUnit.Megavoltampere, "Megavoltamperes", BaseUnits.Undefined, "ElectricApparentPower"),
- new UnitInfo(ElectricApparentPowerUnit.Microvoltampere, "Microvoltamperes", BaseUnits.Undefined, "ElectricApparentPower"),
+ new UnitInfo(ElectricApparentPowerUnit.Megavoltampere, "Megavoltamperes", new BaseUnits(length: LengthUnit.Kilometer, mass: MassUnit.Kilogram, time: DurationUnit.Second), "ElectricApparentPower"),
+ new UnitInfo(ElectricApparentPowerUnit.Microvoltampere, "Microvoltamperes", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Milligram, time: DurationUnit.Second), "ElectricApparentPower"),
new UnitInfo(ElectricApparentPowerUnit.Millivoltampere, "Millivoltamperes", BaseUnits.Undefined, "ElectricApparentPower"),
new UnitInfo(ElectricApparentPowerUnit.Voltampere, "Voltamperes", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Second), "ElectricApparentPower"),
},
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs
index fa52acf1dd..0f55ea6825 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs
@@ -78,11 +78,11 @@ static ElectricCapacitance()
{
new UnitInfo(ElectricCapacitanceUnit.Farad, "Farads", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Second, current: ElectricCurrentUnit.Ampere), "ElectricCapacitance"),
new UnitInfo(ElectricCapacitanceUnit.Kilofarad, "Kilofarads", BaseUnits.Undefined, "ElectricCapacitance"),
- new UnitInfo(ElectricCapacitanceUnit.Megafarad, "Megafarads", BaseUnits.Undefined, "ElectricCapacitance"),
- new UnitInfo(ElectricCapacitanceUnit.Microfarad, "Microfarads", BaseUnits.Undefined, "ElectricCapacitance"),
+ new UnitInfo(ElectricCapacitanceUnit.Megafarad, "Megafarads", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Milligram, time: DurationUnit.Second, current: ElectricCurrentUnit.Ampere), "ElectricCapacitance"),
+ new UnitInfo(ElectricCapacitanceUnit.Microfarad, "Microfarads", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Second, current: ElectricCurrentUnit.Milliampere), "ElectricCapacitance"),
new UnitInfo(ElectricCapacitanceUnit.Millifarad, "Millifarads", BaseUnits.Undefined, "ElectricCapacitance"),
new UnitInfo(ElectricCapacitanceUnit.Nanofarad, "Nanofarads", BaseUnits.Undefined, "ElectricCapacitance"),
- new UnitInfo(ElectricCapacitanceUnit.Picofarad, "Picofarads", BaseUnits.Undefined, "ElectricCapacitance"),
+ new UnitInfo(ElectricCapacitanceUnit.Picofarad, "Picofarads", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Second, current: ElectricCurrentUnit.Microampere), "ElectricCapacitance"),
},
BaseUnit, Zero, BaseDimensions);
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs
index 0b60cac8bf..13300c172c 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs
@@ -83,15 +83,15 @@ static ElectricCharge()
{
new UnitInfo(ElectricChargeUnit.AmpereHour, "AmpereHours", new BaseUnits(time: DurationUnit.Hour, current: ElectricCurrentUnit.Ampere), "ElectricCharge"),
new UnitInfo(ElectricChargeUnit.Coulomb, "Coulombs", new BaseUnits(time: DurationUnit.Second, current: ElectricCurrentUnit.Ampere), "ElectricCharge"),
- new UnitInfo(ElectricChargeUnit.KiloampereHour, "KiloampereHours", BaseUnits.Undefined, "ElectricCharge"),
- new UnitInfo(ElectricChargeUnit.Kilocoulomb, "Kilocoulombs", BaseUnits.Undefined, "ElectricCharge"),
- new UnitInfo(ElectricChargeUnit.MegaampereHour, "MegaampereHours", BaseUnits.Undefined, "ElectricCharge"),
- new UnitInfo(ElectricChargeUnit.Megacoulomb, "Megacoulombs", BaseUnits.Undefined, "ElectricCharge"),
- new UnitInfo(ElectricChargeUnit.Microcoulomb, "Microcoulombs", BaseUnits.Undefined, "ElectricCharge"),
- new UnitInfo(ElectricChargeUnit.MilliampereHour, "MilliampereHours", BaseUnits.Undefined, "ElectricCharge"),
- new UnitInfo(ElectricChargeUnit.Millicoulomb, "Millicoulombs", BaseUnits.Undefined, "ElectricCharge"),
- new UnitInfo(ElectricChargeUnit.Nanocoulomb, "Nanocoulombs", BaseUnits.Undefined, "ElectricCharge"),
- new UnitInfo(ElectricChargeUnit.Picocoulomb, "Picocoulombs", BaseUnits.Undefined, "ElectricCharge"),
+ new UnitInfo(ElectricChargeUnit.KiloampereHour, "KiloampereHours", new BaseUnits(time: DurationUnit.Hour, current: ElectricCurrentUnit.Kiloampere), "ElectricCharge"),
+ new UnitInfo(ElectricChargeUnit.Kilocoulomb, "Kilocoulombs", new BaseUnits(time: DurationUnit.Second, current: ElectricCurrentUnit.Kiloampere), "ElectricCharge"),
+ new UnitInfo(ElectricChargeUnit.MegaampereHour, "MegaampereHours", new BaseUnits(time: DurationUnit.Hour, current: ElectricCurrentUnit.Megaampere), "ElectricCharge"),
+ new UnitInfo(ElectricChargeUnit.Megacoulomb, "Megacoulombs", new BaseUnits(time: DurationUnit.Second, current: ElectricCurrentUnit.Megaampere), "ElectricCharge"),
+ new UnitInfo(ElectricChargeUnit.Microcoulomb, "Microcoulombs", new BaseUnits(time: DurationUnit.Second, current: ElectricCurrentUnit.Microampere), "ElectricCharge"),
+ new UnitInfo(ElectricChargeUnit.MilliampereHour, "MilliampereHours", new BaseUnits(time: DurationUnit.Hour, current: ElectricCurrentUnit.Milliampere), "ElectricCharge"),
+ new UnitInfo(ElectricChargeUnit.Millicoulomb, "Millicoulombs", new BaseUnits(time: DurationUnit.Second, current: ElectricCurrentUnit.Milliampere), "ElectricCharge"),
+ new UnitInfo