diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
index 66d033f8bc..5c3a6a9c59 100644
--- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
+++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
@@ -135,7 +135,7 @@ private void GenerateStaticConstructor()
if (baseUnits == null)
{
Writer.WL($@"
- new UnitInfo<{_unitEnumName}>({_unitEnumName}.{unit.SingularName}, ""{unit.PluralName}"", BaseUnits.Undefined),");
+ new UnitInfo<{_unitEnumName}>({_unitEnumName}.{unit.SingularName}, ""{unit.PluralName}"", BaseUnits.Undefined, ""{_quantity.Name}""),");
}
else
{
@@ -152,7 +152,7 @@ private void GenerateStaticConstructor()
}.Where(str => str != null));
Writer.WL($@"
- new UnitInfo<{_unitEnumName}>({_unitEnumName}.{unit.SingularName}, ""{unit.PluralName}"", new BaseUnits({baseUnitsCtorArgs})),");
+ new UnitInfo<{_unitEnumName}>({_unitEnumName}.{unit.SingularName}, ""{unit.PluralName}"", new BaseUnits({baseUnitsCtorArgs}), ""{_quantity.Name}""),");
}
}
@@ -359,25 +359,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
Writer.WL($@"
}}
- internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbreviationsCache)
- {{");
- foreach(Unit unit in _quantity.Units)
- {
- foreach(Localization localization in unit.Localization)
- {
- // All units must have a unit abbreviation, so fallback to "" for units with no abbreviations defined in JSON
- var abbreviationParams = localization.Abbreviations.Any() ?
- string.Join(", ", localization.Abbreviations.Select(abbr => $@"""{abbr}""")) :
- $@"""""";
-
- Writer.WL($@"
- unitAbbreviationsCache.PerformAbbreviationMapping({_unitEnumName}.{unit.SingularName}, new CultureInfo(""{localization.Culture}""), false, {unit.AllowAbbreviationLookup.ToString().ToLower()}, new string[]{{{abbreviationParams}}});");
- }
- }
-
- Writer.WL($@"
- }}
-
///
/// Get unit abbreviation string.
///
diff --git a/CodeGen/Generators/UnitsNetGen/StaticQuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/StaticQuantityGenerator.cs
index f1f19b9165..502437b592 100644
--- a/CodeGen/Generators/UnitsNetGen/StaticQuantityGenerator.cs
+++ b/CodeGen/Generators/UnitsNetGen/StaticQuantityGenerator.cs
@@ -30,7 +30,7 @@ namespace UnitsNet
///
/// Dynamically parse or construct quantities when types are only known at runtime.
///
- public static partial class Quantity
+ public partial class Quantity
{
///
/// All QuantityInfo instances mapped by quantity name that are present in UnitsNet by default.
@@ -63,7 +63,7 @@ public static IQuantity FromQuantityInfo(QuantityInfo quantityInfo, QuantityValu
Writer.WL(@"
_ => throw new ArgumentException($""{quantityInfo.Name} is not a supported quantity."")
};
- }
+ }
///
/// Try to dynamically construct a quantity.
@@ -74,7 +74,7 @@ public static IQuantity FromQuantityInfo(QuantityInfo quantityInfo, QuantityValu
/// True if successful with assigned the value, otherwise false.
public static bool TryFrom(QuantityValue value, Enum? unit, [NotNullWhen(true)] out IQuantity? quantity)
{
- switch (unit)
+ quantity = unit switch
{");
foreach (var quantity in _quantities)
{
@@ -82,18 +82,14 @@ public static bool TryFrom(QuantityValue value, Enum? unit, [NotNullWhen(true)]
var unitTypeName = $"{quantityName}Unit";
var unitValue = unitTypeName.ToCamelCase();
Writer.WL($@"
- case {unitTypeName} {unitValue}:
- quantity = {quantityName}.From(value, {unitValue});
- return true;");
+ {unitTypeName} {unitValue} => {quantityName}.From(value, {unitValue}),");
}
Writer.WL(@"
- default:
- {
- quantity = default(IQuantity);
- return false;
- }
- }
+ _ => null
+ };
+
+ return quantity is not null;
}
///
@@ -125,7 +121,7 @@ public static bool TryParse(IFormatProvider? formatProvider, Type quantityType,
Writer.WL(@"
_ => false
};
- }
+ }
internal static IEnumerable GetQuantityTypes()
{");
diff --git a/CodeGen/Generators/UnitsNetGenerator.cs b/CodeGen/Generators/UnitsNetGenerator.cs
index 4d75e68006..ca23308212 100644
--- a/CodeGen/Generators/UnitsNetGenerator.cs
+++ b/CodeGen/Generators/UnitsNetGenerator.cs
@@ -1,6 +1,7 @@
// 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.IO;
using System.Linq;
using CodeGen.Generators.UnitsNetGen;
@@ -71,6 +72,7 @@ public static void Generate(string rootDir, Quantity[] quantities, QuantityNameT
Log.Information("");
GenerateIQuantityTests(quantities, $"{testProjectDir}/GeneratedCode/IQuantityTests.g.cs");
GenerateStaticQuantity(quantities, $"{outputDir}/Quantity.g.cs");
+ GenerateResourceFiles(quantities, $"{outputDir}/Resources");
var unitCount = quantities.SelectMany(q => q.Units).Count();
Log.Information("");
@@ -130,5 +132,54 @@ private static void GenerateStaticQuantity(Quantity[] quantities, string filePat
File.WriteAllText(filePath, content);
Log.Information("✅ Quantity.g.cs");
}
+
+ private static void GenerateResourceFiles(Quantity[] quantities, string resourcesDirectory)
+ {
+ foreach(var quantity in quantities)
+ {
+ var cultures = new HashSet();
+
+ foreach(Unit unit in quantity.Units)
+ {
+ foreach(Localization localization in unit.Localization)
+ {
+ cultures.Add(localization.Culture);
+ }
+ }
+
+ foreach(var culture in cultures)
+ {
+ var fileName = culture.Equals("en-US", System.StringComparison.InvariantCultureIgnoreCase) ?
+ $"{resourcesDirectory}/{quantity.Name}.restext" :
+ $"{resourcesDirectory}/{quantity.Name}.{culture}.restext";
+
+ using var writer = File.CreateText(fileName);
+
+ foreach(Unit unit in quantity.Units)
+ {
+ foreach(Localization localization in unit.Localization)
+ {
+ if(localization.Culture == culture)
+ {
+ if(localization.Abbreviations.Any())
+ {
+ writer.Write($"{unit.PluralName}=");
+
+ for(int i = 0; i < localization.Abbreviations.Length; i++)
+ {
+ writer.Write($"{localization.Abbreviations[i]}");
+
+ if(i != localization.Abbreviations.Length - 1)
+ writer.Write(",");
+ }
+
+ writer.WriteLine();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
}
diff --git a/UnitsNet/BaseUnits.cs b/UnitsNet/BaseUnits.cs
index cd1b580db8..578bc291a0 100644
--- a/UnitsNet/BaseUnits.cs
+++ b/UnitsNet/BaseUnits.cs
@@ -138,21 +138,28 @@ public override int GetHashCode()
///
public override string ToString()
{
- var sb = new StringBuilder();
-
- string GetDefaultAbbreviation(TUnitType? unitOrNull) where TUnitType : struct, Enum => unitOrNull is { } unit
- ? UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit)
- : "N/A";
-
- sb.AppendFormat("[Length]: {0}, ", GetDefaultAbbreviation(Length));
- sb.AppendFormat("[Mass]: {0}, ", GetDefaultAbbreviation(Mass));
- sb.AppendFormat("[Time]: {0}, ", GetDefaultAbbreviation(Time));
- sb.AppendFormat("[Current]: {0}, ", GetDefaultAbbreviation(Current));
- sb.AppendFormat("[Temperature]: {0}, ", GetDefaultAbbreviation(Temperature));
- sb.AppendFormat("[Amount]: {0}, ", GetDefaultAbbreviation(Amount));
- sb.AppendFormat("[LuminousIntensity]: {0}", GetDefaultAbbreviation(LuminousIntensity));
-
- return sb.ToString();
+ if(!Equals(Undefined))
+ {
+ var sb = new StringBuilder();
+
+ string GetDefaultAbbreviation(TUnitType? unitOrNull) where TUnitType : struct, Enum => unitOrNull is { } unit
+ ? UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit)
+ : "N/A";
+
+ sb.AppendFormat("[Length]: {0}, ", GetDefaultAbbreviation(Length));
+ sb.AppendFormat("[Mass]: {0}, ", GetDefaultAbbreviation(Mass));
+ sb.AppendFormat("[Time]: {0}, ", GetDefaultAbbreviation(Time));
+ sb.AppendFormat("[Current]: {0}, ", GetDefaultAbbreviation(Current));
+ sb.AppendFormat("[Temperature]: {0}, ", GetDefaultAbbreviation(Temperature));
+ sb.AppendFormat("[Amount]: {0}, ", GetDefaultAbbreviation(Amount));
+ sb.AppendFormat("[LuminousIntensity]: {0}", GetDefaultAbbreviation(LuminousIntensity));
+
+ return sb.ToString();
+ }
+ else
+ {
+ return "Undefined";
+ }
}
///
diff --git a/UnitsNet/CustomCode/Quantities/Length.extra.cs b/UnitsNet/CustomCode/Quantities/Length.extra.cs
index 5e161269a7..7c41035344 100644
--- a/UnitsNet/CustomCode/Quantities/Length.extra.cs
+++ b/UnitsNet/CustomCode/Quantities/Length.extra.cs
@@ -227,8 +227,8 @@ public string ToString(IFormatProvider? cultureInfo)
{
cultureInfo = cultureInfo ?? CultureInfo.CurrentCulture;
- var footUnit = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(LengthUnit.Foot, cultureInfo);
- var inchUnit = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(LengthUnit.Inch, cultureInfo);
+ var footUnit = Length.GetAbbreviation(LengthUnit.Foot, cultureInfo);
+ var inchUnit = Length.GetAbbreviation(LengthUnit.Inch, cultureInfo);
// Note that it isn't customary to use fractions - one wouldn't say "I am 5 feet and 4.5 inches".
// So inches are rounded when converting from base units to feet/inches.
diff --git a/UnitsNet/CustomCode/Quantities/Mass.extra.cs b/UnitsNet/CustomCode/Quantities/Mass.extra.cs
index 810bce1cb1..e82862fc21 100644
--- a/UnitsNet/CustomCode/Quantities/Mass.extra.cs
+++ b/UnitsNet/CustomCode/Quantities/Mass.extra.cs
@@ -156,8 +156,8 @@ public string ToString(IFormatProvider? cultureInfo)
{
cultureInfo = cultureInfo ?? CultureInfo.CurrentCulture;
- var stoneUnit = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(MassUnit.Stone, cultureInfo);
- var poundUnit = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(MassUnit.Pound, cultureInfo);
+ var stoneUnit = Mass.GetAbbreviation(MassUnit.Stone, cultureInfo);
+ var poundUnit = Mass.GetAbbreviation(MassUnit.Pound, cultureInfo);
// Note that it isn't customary to use fractions - one wouldn't say "I am 11 stone and 4.5 pounds".
// So pounds are rounded here.
diff --git a/UnitsNet/CustomCode/Quantity.cs b/UnitsNet/CustomCode/Quantity.cs
index d28d8da7f8..c9055717ce 100644
--- a/UnitsNet/CustomCode/Quantity.cs
+++ b/UnitsNet/CustomCode/Quantity.cs
@@ -2,56 +2,49 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
-using System.Linq;
using UnitsNet.Units;
namespace UnitsNet
{
public partial class Quantity
{
- private static readonly Lazy InfosLazy;
- private static readonly Lazy> UnitTypeAndNameToUnitInfoLazy;
-
static Quantity()
{
- ICollection quantityInfos = ByName.Values;
- Names = quantityInfos.Select(qt => qt.Name).ToArray();
-
- InfosLazy = new Lazy(() => quantityInfos
- .OrderBy(quantityInfo => quantityInfo.Name)
- .ToArray());
+ Default = new QuantityInfoLookup();
+ }
- UnitTypeAndNameToUnitInfoLazy = new Lazy>(() =>
- {
- return Infos
- .SelectMany(quantityInfo => quantityInfo.UnitInfos
- .Select(unitInfo => new KeyValuePair<(Type, string), UnitInfo>(
- (unitInfo.Value.GetType(), unitInfo.Name),
- unitInfo)))
- .ToDictionary(x => x.Key, x => x.Value);
- });
+ private static QuantityInfoLookup Default
+ {
+ get;
}
///
/// All enum value names of , such as "Length" and "Mass".
///
- public static string[] Names { get; }
+ public static string[] Names { get => Default.Names; }
///
/// All quantity information objects, such as and .
///
- public static QuantityInfo[] Infos => InfosLazy.Value;
+ public static QuantityInfo[] Infos => Default.Infos;
///
/// Get for a given unit enum value.
///
- public static UnitInfo GetUnitInfo(Enum unitEnum) => UnitTypeAndNameToUnitInfoLazy.Value[(unitEnum.GetType(), unitEnum.ToString())];
+ public static UnitInfo GetUnitInfo(Enum unitEnum) => Default.GetUnitInfo(unitEnum);
///
/// Try to get for a given unit enum value.
///
public static bool TryGetUnitInfo(Enum unitEnum, [NotNullWhen(true)] out UnitInfo? unitInfo) =>
- UnitTypeAndNameToUnitInfoLazy.Value.TryGetValue((unitEnum.GetType(), unitEnum.ToString()), out unitInfo);
+ Default.TryGetUnitInfo(unitEnum, out unitInfo);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void AddUnitInfo(Enum unit, UnitInfo unitInfo) => Default.AddUnitInfo(unit, unitInfo);
///
/// Dynamically constructs a quantity from a numeric value and a unit enum value.
@@ -62,156 +55,17 @@ public static bool TryGetUnitInfo(Enum unitEnum, [NotNullWhen(true)] out UnitInf
/// Unit value is not a known unit enum type.
public static IQuantity From(QuantityValue value, Enum unit)
{
- return TryFrom(value, unit, out IQuantity? quantity)
- ? quantity
- : throw new UnitNotFoundException($"Unit value {unit} of type {unit.GetType()} is not a known unit enum type. Expected types like UnitsNet.Units.LengthUnit. Did you pass in a custom enum type defined outside the UnitsNet library?");
- }
-
- ///
- /// Dynamically construct a quantity from a value, the quantity name and the unit name.
- ///
- /// Numeric value.
- /// The invariant quantity name, such as "Length". Does not support localization.
- /// The invariant unit enum name, such as "Meter". Does not support localization.
- /// An object.
- /// Unit value is not a known unit enum type.
- public static IQuantity From(QuantityValue value, string quantityName, string unitName)
- {
- // Get enum value for this unit, f.ex. LengthUnit.Meter for unit name "Meter".
- return UnitConverter.TryParseUnit(quantityName, unitName, out Enum? unitValue)
- ? From(value, unitValue)
- : throw new UnitNotFoundException($"Unit [{unitName}] not found for quantity [{quantityName}].");
- }
-
- ///
- /// Dynamically construct a quantity from a numeric value and a unit abbreviation using .
- ///
- ///
- /// This method is currently not optimized for performance and will enumerate all units and their unit abbreviations each time.
- /// Unit abbreviation matching is case-insensitive.
- ///
- /// This will fail if more than one unit across all quantities share the same unit abbreviation.
- /// Prefer or instead.
- ///
- /// Numeric value.
- /// Unit abbreviation, such as "kg" for .
- /// An object.
- /// Unit abbreviation is not known.
- /// Multiple units found matching the given unit abbreviation.
- public static IQuantity FromUnitAbbreviation(QuantityValue value, string unitAbbreviation) => FromUnitAbbreviation(null, value, unitAbbreviation);
-
- ///
- /// Dynamically construct a quantity from a numeric value and a unit abbreviation.
- ///
- ///
- /// This method is currently not optimized for performance and will enumerate all units and their unit abbreviations each time.
- /// Unit abbreviation matching is case-insensitive.
- ///
- /// This will fail if more than one unit across all quantities share the same unit abbreviation.
- /// Prefer or instead.
- ///
- /// The format provider to use for lookup. Defaults to if null.
- /// Numeric value.
- /// Unit abbreviation, such as "kg" for .
- /// An object.
- /// Unit abbreviation is not known.
- /// Multiple units found matching the given unit abbreviation.
- public static IQuantity FromUnitAbbreviation(IFormatProvider? formatProvider, QuantityValue value, string unitAbbreviation)
- {
- // TODO Optimize this with UnitValueAbbreviationLookup via UnitAbbreviationsCache.TryGetUnitValueAbbreviationLookup.
- List units = GetUnitsForAbbreviation(formatProvider, unitAbbreviation);
- if (units.Count > 1)
- {
- throw new AmbiguousUnitParseException($"Multiple units found matching the given unit abbreviation: {unitAbbreviation}");
- }
-
- if (units.Count == 0)
- {
- throw new UnitNotFoundException($"Unit abbreviation {unitAbbreviation} is not known. Did you pass in a custom unit abbreviation defined outside the UnitsNet library? This is currently not supported.");
- }
-
- Enum unit = units.Single();
- return From(value, unit);
+ return Default.From(value, unit);
}
///
public static bool TryFrom(double value, Enum unit, [NotNullWhen(true)] out IQuantity? quantity)
{
- quantity = default;
-
- // Implicit cast to QuantityValue would prevent TryFrom from being called,
- // so we need to explicitly check this here for double arguments.
- return !double.IsNaN(value) &&
- !double.IsInfinity(value) &&
- TryFrom((QuantityValue)value, unit, out quantity);
- }
-
- ///
- /// Try to dynamically construct a quantity from a value, the quantity name and the unit name.
- ///
- /// Numeric value.
- /// The invariant unit enum name, such as "Meter". Does not support localization.
- /// The invariant quantity name, such as "Length". Does not support localization.
- /// The constructed quantity, if successful, otherwise null.
- /// True if successful with assigned the value, otherwise false.
- public static bool TryFrom(double value, string quantityName, string unitName, [NotNullWhen(true)] out IQuantity? quantity)
- {
- quantity = default;
-
- return UnitConverter.TryParseUnit(quantityName, unitName, out Enum? unitValue) &&
- TryFrom(value, unitValue, out quantity);
- }
-
- ///
- /// Dynamically construct a quantity from a numeric value and a unit abbreviation using .
- ///
- ///
- /// This method is currently not optimized for performance and will enumerate all units and their unit abbreviations each time.
- /// Unit abbreviation matching is case-insensitive.
- ///
- /// This will fail if more than one unit across all quantities share the same unit abbreviation.
- /// Prefer or instead.
- ///
- /// Numeric value.
- /// Unit abbreviation, such as "kg" for .
- /// The quantity if successful, otherwise null.
- /// True if successful.
- /// Unit value is not a known unit enum type.
- public static bool TryFromUnitAbbreviation(QuantityValue value, string unitAbbreviation, [NotNullWhen(true)] out IQuantity? quantity) =>
- TryFromUnitAbbreviation(null, value, unitAbbreviation, out quantity);
-
- ///
- /// Dynamically construct a quantity from a numeric value and a unit abbreviation.
- ///
- ///
- /// This method is currently not optimized for performance and will enumerate all units and their unit abbreviations each time.
- /// Unit abbreviation matching is case-insensitive.
- ///
- /// This will fail if more than one unit across all quantities share the same unit abbreviation.
- /// Prefer or instead.
- ///
- /// The format provider to use for lookup. Defaults to if null.
- /// Numeric value.
- /// Unit abbreviation, such as "kg" for .
- /// The quantity if successful, otherwise null.
- /// True if successful.
- /// Unit value is not a known unit enum type.
- public static bool TryFromUnitAbbreviation(IFormatProvider? formatProvider, QuantityValue value, string unitAbbreviation, [NotNullWhen(true)] out IQuantity? quantity)
- {
- // TODO Optimize this with UnitValueAbbreviationLookup via UnitAbbreviationsCache.TryGetUnitValueAbbreviationLookup.
- List units = GetUnitsForAbbreviation(formatProvider, unitAbbreviation);
- if (units.Count == 1)
- {
- Enum? unit = units.SingleOrDefault();
- return TryFrom(value, unit, out quantity);
- }
-
- quantity = default;
- return false;
+ return Default.TryFrom(value, unit, out quantity);
}
///
- public static IQuantity Parse(Type quantityType, string quantityString) => Parse(null, quantityType, quantityString);
+ public static IQuantity Parse(Type quantityType, string quantityString) => Default.Parse(null, quantityType, quantityString);
///
/// Dynamically parse a quantity string representation.
@@ -224,18 +78,12 @@ public static bool TryFromUnitAbbreviation(IFormatProvider? formatProvider, Quan
/// Type must be of type UnitsNet.IQuantity -or- Type is not a known quantity type.
public static IQuantity Parse(IFormatProvider? formatProvider, Type quantityType, string quantityString)
{
- if (!typeof(IQuantity).IsAssignableFrom(quantityType))
- throw new ArgumentException($"Type {quantityType} must be of type UnitsNet.IQuantity.");
-
- if (TryParse(formatProvider, quantityType, quantityString, out IQuantity? quantity))
- return quantity;
-
- throw new UnitNotFoundException($"Quantity string could not be parsed to quantity {quantityType}.");
+ return Default.Parse(formatProvider, quantityType, quantityString);
}
///
public static bool TryParse(Type quantityType, string quantityString, [NotNullWhen(true)] out IQuantity? quantity) =>
- TryParse(null, quantityType, quantityString, out quantity);
+ Default.TryParse(quantityType, quantityString, out quantity);
///
/// Get a list of quantities that has the given base dimensions.
@@ -243,7 +91,7 @@ public static bool TryParse(Type quantityType, string quantityString, [NotNullWh
/// The base dimensions to match.
public static IEnumerable GetQuantitiesWithBaseDimensions(BaseDimensions baseDimensions)
{
- return InfosLazy.Value.Where(info => info.BaseDimensions.Equals(baseDimensions));
+ return Default.GetQuantitiesWithBaseDimensions(baseDimensions);
}
private static List GetUnitsForAbbreviation(IFormatProvider? formatProvider, string unitAbbreviation)
diff --git a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs
index 6bb34bf28f..602430476b 100644
--- a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs
+++ b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs
@@ -5,11 +5,8 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
-using System.Reflection;
using UnitsNet.Units;
-using UnitTypeToLookup = System.Collections.Generic.Dictionary;
-
// ReSharper disable once CheckNamespace
namespace UnitsNet
{
@@ -19,8 +16,6 @@ namespace UnitsNet
///
public sealed class UnitAbbreviationsCache
{
- private readonly Dictionary _lookupsForCulture;
-
///
/// Fallback culture used by and
/// if no abbreviations are found with a given culture.
@@ -37,14 +32,14 @@ public sealed class UnitAbbreviationsCache
///
public static UnitAbbreviationsCache Default { get; }
+ private QuantityInfoLookup QuantityInfoLookup { get; }
+
///
/// Create an instance of the cache and load all the abbreviations defined in the library.
///
public UnitAbbreviationsCache()
{
- _lookupsForCulture = new Dictionary();
-
- LoadGeneratedAbbreviations();
+ QuantityInfoLookup= new QuantityInfoLookup();
}
static UnitAbbreviationsCache()
@@ -52,15 +47,6 @@ static UnitAbbreviationsCache()
Default = new UnitAbbreviationsCache();
}
- private void LoadGeneratedAbbreviations()
- {
- foreach (Type quantity in Quantity.GetQuantityTypes())
- {
- var mapGeneratedLocalizationsMethod = quantity.GetMethod(nameof(Length.MapGeneratedLocalizations), BindingFlags.NonPublic | BindingFlags.Static);
- mapGeneratedLocalizationsMethod?.Invoke(null, new object[]{this});
- }
- }
-
///
/// Adds one or more unit abbreviation for the given unit enum value.
/// This is used to dynamically add abbreviations for existing unit enums such as or to extend with third-party unit enums
@@ -147,23 +133,13 @@ public void MapUnitToDefaultAbbreviation(Type unitType, int unitValue, IFormatPr
internal void PerformAbbreviationMapping(Enum unitValue, IFormatProvider? formatProvider, bool setAsDefault, bool allowAbbreviationLookup, params string[] abbreviations)
{
- if (abbreviations == null)
- throw new ArgumentNullException(nameof(abbreviations));
-
- formatProvider ??= CultureInfo.CurrentCulture;
-
- if (!_lookupsForCulture.TryGetValue(formatProvider, out var quantitiesForProvider))
- quantitiesForProvider = _lookupsForCulture[formatProvider] = new UnitTypeToLookup();
-
- var unitType = unitValue.GetType();
- if (!quantitiesForProvider.TryGetValue(unitType, out var unitToAbbreviations))
- unitToAbbreviations = quantitiesForProvider[unitType] = new UnitValueAbbreviationLookup();
-
- var unitValueAsInt = Convert.ToInt32(unitValue);
- foreach (var abbr in abbreviations)
+ if(!QuantityInfoLookup.TryGetUnitInfo(unitValue, out var unitInfo))
{
- unitToAbbreviations.Add(unitValueAsInt, abbr, setAsDefault, allowAbbreviationLookup);
+ unitInfo = new UnitInfo(unitValue, unitValue.ToString(), BaseUnits.Undefined);
+ QuantityInfoLookup.AddUnitInfo(unitValue, unitInfo);
}
+
+ unitInfo.AddAbbreviation(formatProvider, setAsDefault, allowAbbreviationLookup, abbreviations);
}
///
@@ -177,23 +153,7 @@ internal void PerformAbbreviationMapping(Enum unitValue, IFormatProvider? format
public string GetDefaultAbbreviation(TUnitType unit, IFormatProvider? formatProvider = null) where TUnitType : Enum
{
var unitType = typeof(TUnitType);
-
- if (!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup))
- {
- return !Equals(formatProvider, FallbackCulture)
- ? GetDefaultAbbreviation(unit, FallbackCulture)
- : throw new NotImplementedException($"No abbreviation is specified for {unitType.Name}.{unit}");
- }
-
- var abbreviations = lookup!.GetAbbreviationsForUnit(unit);
- if (abbreviations.Count == 0)
- {
- return !Equals(formatProvider, FallbackCulture)
- ? GetDefaultAbbreviation(unit, FallbackCulture)
- : throw new NotImplementedException($"No abbreviation is specified for {unitType.Name}.{unit}");
- }
-
- return abbreviations.First();
+ return GetDefaultAbbreviation(unitType, Convert.ToInt32(unit), formatProvider);
}
///
@@ -207,22 +167,8 @@ public string GetDefaultAbbreviation(TUnitType unit, IFormatProvider?
/// The default unit abbreviation string.
public string GetDefaultAbbreviation(Type unitType, int unitValue, IFormatProvider? formatProvider = null)
{
- if (!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup))
- {
- return !Equals(formatProvider, FallbackCulture)
- ? GetDefaultAbbreviation(unitType, unitValue, FallbackCulture)
- : throw new NotImplementedException($"No abbreviation is specified for {unitType.Name} with numeric value {unitValue}.");
- }
-
- var abbreviations = lookup!.GetAbbreviationsForUnit(unitValue);
- if (abbreviations.Count == 0)
- {
- return !Equals(formatProvider, FallbackCulture)
- ? GetDefaultAbbreviation(unitType, unitValue, FallbackCulture)
- : throw new NotImplementedException($"No abbreviation is specified for {unitType.Name} with numeric value {unitValue}.");
- }
-
- return abbreviations.First();
+ var abbreviations = GetUnitAbbreviations(unitType, unitValue, formatProvider);
+ return abbreviations.Length > 0 ? abbreviations[0] : string.Empty;
}
///
@@ -248,22 +194,35 @@ public string[] GetUnitAbbreviations(Type unitType, int unitValue, IFormatProvid
{
formatProvider ??= CultureInfo.CurrentCulture;
- if (!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup))
+ if(TryGetUnitAbbreviations(unitType, unitValue, formatProvider, out var abbreviations))
+ return abbreviations;
+ else
+ throw new NotImplementedException($"No abbreviation is specified for {unitType.Name} with numeric value {unitValue}.");
+ }
+
+ ///
+ /// Get all abbreviations for unit.
+ ///
+ /// Enum type for unit.
+ /// Enum value for unit.
+ /// The format provider to use for lookup. Defaults to if null.
+ /// The unit abbreviations associated with unit.
+ /// True if found, otherwise false.
+ private bool TryGetUnitAbbreviations(Type unitType, int unitValue, IFormatProvider? formatProvider, out string[] abbreviations)
+ {
+ var name = Enum.GetName(unitType, unitValue);
+ var enumInstance = (Enum)Enum.Parse(unitType, name!);
+
+ if(QuantityInfoLookup.TryGetUnitInfo(enumInstance, out var unitInfo))
{
- return !Equals(formatProvider, FallbackCulture)
- ? GetUnitAbbreviations(unitType, unitValue, FallbackCulture)
- : new string[] { };
+ abbreviations = unitInfo.GetAbbreviations(formatProvider!).ToArray();
+ return true;
}
-
- var abbreviations = lookup!.GetAbbreviationsForUnit(unitValue);
- if (abbreviations.Count == 0)
+ else
{
- return !Equals(formatProvider, FallbackCulture)
- ? GetUnitAbbreviations(unitType, unitValue, FallbackCulture)
- : new string[] { };
+ abbreviations = Array.Empty();
+ return false;
}
-
- return abbreviations.ToArray();
}
///
@@ -274,37 +233,28 @@ public string[] GetUnitAbbreviations(Type unitType, int unitValue, IFormatProvid
/// Unit abbreviations associated with unit.
public IReadOnlyList GetAllUnitAbbreviationsForQuantity(Type unitEnumType, IFormatProvider? formatProvider = null)
{
- formatProvider ??= CultureInfo.CurrentCulture;
-
- if (!TryGetUnitValueAbbreviationLookup(unitEnumType, formatProvider, out var lookup))
- {
- return !Equals(formatProvider, FallbackCulture)
- ? GetAllUnitAbbreviationsForQuantity(unitEnumType, FallbackCulture)
- : new string[] { };
- }
-
- return lookup!.GetAllUnitAbbreviationsForQuantity();
+ var enumValues = Enum.GetValues(unitEnumType).Cast();
+ var all = GetStringUnitPairs(enumValues, formatProvider);
+ return all.Select(pair => pair.Item1).ToList();
}
- internal bool TryGetUnitValueAbbreviationLookup(Type unitType, IFormatProvider? formatProvider, out UnitValueAbbreviationLookup? unitToAbbreviations)
+ internal List<(string Abbreviation, Enum Unit)> GetStringUnitPairs(IEnumerable enumValues, IFormatProvider? formatProvider = null)
{
- unitToAbbreviations = null;
-
+ var ret = new List<(string, Enum)>();
formatProvider ??= CultureInfo.CurrentCulture;
- if (!_lookupsForCulture.TryGetValue(formatProvider, out UnitTypeToLookup? quantitiesForProvider))
- {
- return !Equals(formatProvider, FallbackCulture) &&
- TryGetUnitValueAbbreviationLookup(unitType, FallbackCulture, out unitToAbbreviations);
- }
-
- if (!quantitiesForProvider.TryGetValue(unitType, out unitToAbbreviations))
+ foreach(var enumValue in enumValues)
{
- return !Equals(formatProvider, FallbackCulture) &&
- TryGetUnitValueAbbreviationLookup(unitType, FallbackCulture, out unitToAbbreviations);
+ if(TryGetUnitAbbreviations(enumValue.GetType(), Convert.ToInt32(enumValue), formatProvider, out var abbreviations))
+ {
+ foreach(var abbrev in abbreviations)
+ {
+ ret.Add((abbrev, enumValue));
+ }
+ }
}
- return true;
+ return ret;
}
}
}
diff --git a/UnitsNet/CustomCode/UnitParser.cs b/UnitsNet/CustomCode/UnitParser.cs
index 66cd8287d0..142ea9273e 100644
--- a/UnitsNet/CustomCode/UnitParser.cs
+++ b/UnitsNet/CustomCode/UnitParser.cs
@@ -70,35 +70,34 @@ public Enum Parse(string? unitAbbreviation, Type unitType, IFormatProvider? form
if (unitAbbreviation == null) throw new ArgumentNullException(nameof(unitAbbreviation));
unitAbbreviation = unitAbbreviation.Trim();
- if (!_unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations))
- throw new UnitNotFoundException($"No abbreviations defined for unit type [{unitType}] for culture [{formatProvider}].");
+ var enumValues = Enum.GetValues(unitType).Cast();
+ var stringUnitPairs = _unitAbbreviationsCache.GetStringUnitPairs(enumValues, formatProvider);
+ var matches = stringUnitPairs.Where(pair => pair.Item1.Equals(unitAbbreviation, StringComparison.OrdinalIgnoreCase)).ToArray();
- var unitIntValues = abbreviations!.GetUnitsForAbbreviation(unitAbbreviation, ignoreCase: true);
-
- if (unitIntValues.Count == 0)
+ if(matches.Length == 0)
{
unitAbbreviation = NormalizeUnitString(unitAbbreviation);
- unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation, ignoreCase: true);
+ matches = stringUnitPairs.Where(pair => pair.Item1.Equals(unitAbbreviation, StringComparison.OrdinalIgnoreCase)).ToArray();
}
// Narrow the search if too many hits, for example Megabar "Mbar" and Millibar "mbar" need to be distinguished
- if (unitIntValues.Count > 1)
- unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation, ignoreCase: false);
+ if(matches.Length > 1)
+ matches = stringUnitPairs.Where(pair => pair.Item1.Equals(unitAbbreviation)).ToArray();
- switch (unitIntValues.Count)
+ switch(matches.Length)
{
case 1:
- return (Enum) Enum.ToObject(unitType, unitIntValues[0]);
+ return (Enum)Enum.ToObject(unitType, matches[0].Unit);
case 0:
// Retry with fallback culture, if different.
- if (!Equals(formatProvider, UnitAbbreviationsCache.FallbackCulture))
+ if(!Equals(formatProvider, UnitAbbreviationsCache.FallbackCulture))
{
return Parse(unitAbbreviation, unitType, UnitAbbreviationsCache.FallbackCulture);
}
throw new UnitNotFoundException($"Unit not found with abbreviation [{unitAbbreviation}] for unit type [{unitType}].");
default:
- string unitsCsv = string.Join(", ", unitIntValues.Select(x => Enum.GetName(unitType, x)).ToArray());
+ string unitsCsv = string.Join(", ", matches.Select(x => Enum.GetName(unitType, x.Unit)).ToArray());
throw new AmbiguousUnitParseException(
$"Cannot parse \"{unitAbbreviation}\" since it could be either of these: {unitsCsv}");
}
@@ -197,25 +196,24 @@ public bool TryParse(string? unitAbbreviation, Type unitType, IFormatProvider? f
unitAbbreviation = unitAbbreviation.Trim();
unit = default;
- if (!_unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations))
- return false;
-
- var unitIntValues = abbreviations!.GetUnitsForAbbreviation(unitAbbreviation, ignoreCase: true);
+ var enumValues = Enum.GetValues(unitType).Cast();
+ var stringUnitPairs = _unitAbbreviationsCache.GetStringUnitPairs(enumValues, formatProvider);
+ var matches = stringUnitPairs.Where(pair => pair.Item1.Equals(unitAbbreviation, StringComparison.OrdinalIgnoreCase)).ToArray();
- if (unitIntValues.Count == 0)
+ if(matches.Length == 0)
{
unitAbbreviation = NormalizeUnitString(unitAbbreviation);
- unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation, ignoreCase: true);
+ matches = stringUnitPairs.Where(pair => pair.Item1.Equals(unitAbbreviation, StringComparison.OrdinalIgnoreCase)).ToArray();
}
// Narrow the search if too many hits, for example Megabar "Mbar" and Millibar "mbar" need to be distinguished
- if (unitIntValues.Count > 1)
- unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation, ignoreCase: false);
+ if(matches.Length > 1)
+ matches = stringUnitPairs.Where(pair => pair.Item1.Equals(unitAbbreviation)).ToArray();
- if (unitIntValues.Count != 1)
+ if(matches.Length != 1)
return false;
- unit = (Enum)Enum.ToObject(unitType, unitIntValues[0]);
+ unit = (Enum)Enum.ToObject(unitType, matches[ 0 ].Unit);
return true;
}
}
diff --git a/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs b/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs
deleted file mode 100644
index d303658682..0000000000
--- a/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-// 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.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace UnitsNet
-{
- internal class UnitToAbbreviationMap : ConcurrentDictionary> { }
- internal class AbbreviationToUnitMap : ConcurrentDictionary> { }
-
- internal class UnitValueAbbreviationLookup
- {
- private readonly UnitToAbbreviationMap _unitToAbbreviationMap = new();
- private readonly AbbreviationToUnitMap _abbreviationToUnitMap = new();
- private readonly AbbreviationToUnitMap _lowerCaseAbbreviationToUnitMap = new();
- private Lazy _allUnitAbbreviationsLazy;
- private readonly object _syncRoot = new();
-
- public UnitValueAbbreviationLookup()
- {
- _allUnitAbbreviationsLazy = new Lazy(ComputeAllUnitAbbreviationsValue);
- }
-
- internal IReadOnlyList GetAllUnitAbbreviationsForQuantity()
- {
- return _allUnitAbbreviationsLazy.Value;
- }
-
- internal IReadOnlyList GetAbbreviationsForUnit(TUnitType unit) where TUnitType : Enum
- {
- return GetAbbreviationsForUnit(Convert.ToInt32(unit));
- }
-
- internal IReadOnlyList GetAbbreviationsForUnit(int unit)
- {
- if (!_unitToAbbreviationMap.TryGetValue(unit, out var abbreviations))
- return new List(0);
-
- return abbreviations.ToList();
- }
-
- internal IReadOnlyList GetUnitsForAbbreviation(string abbreviation, bool ignoreCase)
- {
- var lowerCaseAbbreviation = abbreviation.ToLower();
- var key = ignoreCase ? lowerCaseAbbreviation : abbreviation;
- var map = ignoreCase ? _lowerCaseAbbreviationToUnitMap : _abbreviationToUnitMap;
-
- if (!map.TryGetValue(key, out IReadOnlyList? units))
- return new List(0);
-
- return units.ToList();
- }
-
- internal void Add(int unit, string abbreviation, bool setAsDefault = false, bool allowAbbreviationLookup = true)
- {
- // Restrict concurrency on writes.
- // By using ConcurrencyDictionary and immutable IReadOnlyList instances, we don't need to lock on reads.
- lock (_syncRoot)
- {
- var lowerCaseAbbreviation = abbreviation.ToLower();
-
- if (allowAbbreviationLookup)
- {
- _abbreviationToUnitMap.AddOrUpdate(abbreviation,
- addValueFactory: _ => new List { unit },
- updateValueFactory: (_, existing) => existing.Append(unit).Distinct().ToList());
-
- _lowerCaseAbbreviationToUnitMap.AddOrUpdate(lowerCaseAbbreviation,
- addValueFactory: _ => new List { unit },
- updateValueFactory: (_, existing) => existing.Append(unit).Distinct().ToList());
- }
-
- _unitToAbbreviationMap.AddOrUpdate(unit,
- addValueFactory: _ => new List { abbreviation },
- updateValueFactory: (_, existing) =>
- {
- return setAsDefault
- ? existing.Where(x => x != abbreviation).Prepend(abbreviation).ToList()
- : existing.Where(x => x != abbreviation).Append(abbreviation).ToList();
- });
-
- _allUnitAbbreviationsLazy = new Lazy(ComputeAllUnitAbbreviationsValue);
- }
- }
-
- private string[] ComputeAllUnitAbbreviationsValue()
- {
- return _unitToAbbreviationMap.Values.SelectMany(abbreviations => abbreviations).Distinct().ToArray();
- }
- }
-}
diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs
index f448e2af59..23e7d42e56 100644
--- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs
@@ -65,20 +65,20 @@ static Acceleration()
Info = new QuantityInfo("Acceleration",
new UnitInfo[]
{
- new UnitInfo(AccelerationUnit.CentimeterPerSecondSquared, "CentimetersPerSecondSquared", BaseUnits.Undefined),
- new UnitInfo(AccelerationUnit.DecimeterPerSecondSquared, "DecimetersPerSecondSquared", BaseUnits.Undefined),
- new UnitInfo(AccelerationUnit.FootPerSecondSquared, "FeetPerSecondSquared", new BaseUnits(length: LengthUnit.Foot, time: DurationUnit.Second)),
- new UnitInfo(AccelerationUnit.InchPerSecondSquared, "InchesPerSecondSquared", new BaseUnits(length: LengthUnit.Inch, time: DurationUnit.Second)),
- new UnitInfo(AccelerationUnit.KilometerPerSecondSquared, "KilometersPerSecondSquared", BaseUnits.Undefined),
- new UnitInfo(AccelerationUnit.KnotPerHour, "KnotsPerHour", new BaseUnits(length: LengthUnit.NauticalMile, time: DurationUnit.Hour)),
- new UnitInfo(AccelerationUnit.KnotPerMinute, "KnotsPerMinute", new BaseUnits(length: LengthUnit.NauticalMile, time: DurationUnit.Minute)),
- new UnitInfo(AccelerationUnit.KnotPerSecond, "KnotsPerSecond", new BaseUnits(length: LengthUnit.NauticalMile, time: DurationUnit.Second)),
- new UnitInfo(AccelerationUnit.MeterPerSecondSquared, "MetersPerSecondSquared", new BaseUnits(length: LengthUnit.Meter, time: DurationUnit.Second)),
- new UnitInfo(AccelerationUnit.MicrometerPerSecondSquared, "MicrometersPerSecondSquared", BaseUnits.Undefined),
- new UnitInfo(AccelerationUnit.MillimeterPerSecondSquared, "MillimetersPerSecondSquared", BaseUnits.Undefined),
- new UnitInfo(AccelerationUnit.MillistandardGravity, "MillistandardGravity", BaseUnits.Undefined),
- new UnitInfo(AccelerationUnit.NanometerPerSecondSquared, "NanometersPerSecondSquared", BaseUnits.Undefined),
- new UnitInfo(AccelerationUnit.StandardGravity, "StandardGravity", new BaseUnits(length: LengthUnit.Meter, time: DurationUnit.Second)),
+ new UnitInfo(AccelerationUnit.CentimeterPerSecondSquared, "CentimetersPerSecondSquared", BaseUnits.Undefined, "Acceleration"),
+ new UnitInfo(AccelerationUnit.DecimeterPerSecondSquared, "DecimetersPerSecondSquared", BaseUnits.Undefined, "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.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.StandardGravity, "StandardGravity", new BaseUnits(length: LengthUnit.Meter, time: DurationUnit.Second), "Acceleration"),
},
BaseUnit, Zero, BaseDimensions);
@@ -296,38 +296,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
unitConverter.SetConversionFunction(AccelerationUnit.MeterPerSecondSquared, AccelerationUnit.StandardGravity, quantity => quantity.ToUnit(AccelerationUnit.StandardGravity));
}
- internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbreviationsCache)
- {
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.CentimeterPerSecondSquared, new CultureInfo("en-US"), false, true, new string[]{"cm/s²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.CentimeterPerSecondSquared, new CultureInfo("ru-RU"), false, true, new string[]{"см/с²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.DecimeterPerSecondSquared, new CultureInfo("en-US"), false, true, new string[]{"dm/s²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.DecimeterPerSecondSquared, new CultureInfo("ru-RU"), false, true, new string[]{"дм/с²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.FootPerSecondSquared, new CultureInfo("en-US"), false, true, new string[]{"ft/s²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.FootPerSecondSquared, new CultureInfo("ru-RU"), false, true, new string[]{"фут/с²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.InchPerSecondSquared, new CultureInfo("en-US"), false, true, new string[]{"in/s²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.InchPerSecondSquared, new CultureInfo("ru-RU"), false, true, new string[]{"дюйм/с²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.KilometerPerSecondSquared, new CultureInfo("en-US"), false, true, new string[]{"km/s²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.KilometerPerSecondSquared, new CultureInfo("ru-RU"), false, true, new string[]{"км/с²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.KnotPerHour, new CultureInfo("en-US"), false, true, new string[]{"kn/h"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.KnotPerHour, new CultureInfo("ru-RU"), false, true, new string[]{"узел/час"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.KnotPerMinute, new CultureInfo("en-US"), false, true, new string[]{"kn/min"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.KnotPerMinute, new CultureInfo("ru-RU"), false, true, new string[]{"узел/мин"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.KnotPerSecond, new CultureInfo("en-US"), false, true, new string[]{"kn/s"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.KnotPerSecond, new CultureInfo("ru-RU"), false, true, new string[]{"узел/с"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.MeterPerSecondSquared, new CultureInfo("en-US"), false, true, new string[]{"m/s²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.MeterPerSecondSquared, new CultureInfo("ru-RU"), false, true, new string[]{"м/с²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.MicrometerPerSecondSquared, new CultureInfo("en-US"), false, true, new string[]{"µm/s²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.MicrometerPerSecondSquared, new CultureInfo("ru-RU"), false, true, new string[]{"мкм/с²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.MillimeterPerSecondSquared, new CultureInfo("en-US"), false, true, new string[]{"mm/s²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.MillimeterPerSecondSquared, new CultureInfo("ru-RU"), false, true, new string[]{"мм/с²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.MillistandardGravity, new CultureInfo("en-US"), false, true, new string[]{"mg"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.MillistandardGravity, new CultureInfo("ru-RU"), false, true, new string[]{"мg"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.NanometerPerSecondSquared, new CultureInfo("en-US"), false, true, new string[]{"nm/s²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.NanometerPerSecondSquared, new CultureInfo("ru-RU"), false, true, new string[]{"нм/с²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.StandardGravity, new CultureInfo("en-US"), false, true, new string[]{"g"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AccelerationUnit.StandardGravity, new CultureInfo("ru-RU"), false, true, new string[]{"g"});
- }
-
///
/// Get unit abbreviation string.
///
diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs
index 7937aeb386..6800ac70a9 100644
--- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs
@@ -65,21 +65,21 @@ static AmountOfSubstance()
Info = new QuantityInfo("AmountOfSubstance",
new UnitInfo[]
{
- new UnitInfo(AmountOfSubstanceUnit.Centimole, "Centimoles", BaseUnits.Undefined),
- new UnitInfo(AmountOfSubstanceUnit.CentipoundMole, "CentipoundMoles", BaseUnits.Undefined),
- new UnitInfo(AmountOfSubstanceUnit.Decimole, "Decimoles", BaseUnits.Undefined),
- new UnitInfo(AmountOfSubstanceUnit.DecipoundMole, "DecipoundMoles", BaseUnits.Undefined),
- new UnitInfo(AmountOfSubstanceUnit.Kilomole, "Kilomoles", BaseUnits.Undefined),
- new UnitInfo(AmountOfSubstanceUnit.KilopoundMole, "KilopoundMoles", BaseUnits.Undefined),
- new UnitInfo(AmountOfSubstanceUnit.Megamole, "Megamoles", BaseUnits.Undefined),
- new UnitInfo(AmountOfSubstanceUnit.Micromole, "Micromoles", BaseUnits.Undefined),
- new UnitInfo(AmountOfSubstanceUnit.MicropoundMole, "MicropoundMoles", BaseUnits.Undefined),
- new UnitInfo(AmountOfSubstanceUnit.Millimole, "Millimoles", BaseUnits.Undefined),
- new UnitInfo(AmountOfSubstanceUnit.MillipoundMole, "MillipoundMoles", BaseUnits.Undefined),
- new UnitInfo(AmountOfSubstanceUnit.Mole, "Moles", new BaseUnits(amount: AmountOfSubstanceUnit.Mole)),
- new UnitInfo(AmountOfSubstanceUnit.Nanomole, "Nanomoles", BaseUnits.Undefined),
- new UnitInfo(AmountOfSubstanceUnit.NanopoundMole, "NanopoundMoles", BaseUnits.Undefined),
- new UnitInfo(AmountOfSubstanceUnit.PoundMole, "PoundMoles", new BaseUnits(amount: AmountOfSubstanceUnit.PoundMole)),
+ 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.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.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.PoundMole, "PoundMoles", new BaseUnits(amount: AmountOfSubstanceUnit.PoundMole), "AmountOfSubstance"),
},
BaseUnit, Zero, BaseDimensions);
@@ -304,25 +304,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
unitConverter.SetConversionFunction(AmountOfSubstanceUnit.Mole, AmountOfSubstanceUnit.PoundMole, quantity => quantity.ToUnit(AmountOfSubstanceUnit.PoundMole));
}
- internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbreviationsCache)
- {
- unitAbbreviationsCache.PerformAbbreviationMapping(AmountOfSubstanceUnit.Centimole, new CultureInfo("en-US"), false, true, new string[]{"cmol"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmountOfSubstanceUnit.CentipoundMole, new CultureInfo("en-US"), false, true, new string[]{"clbmol"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmountOfSubstanceUnit.Decimole, new CultureInfo("en-US"), false, true, new string[]{"dmol"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmountOfSubstanceUnit.DecipoundMole, new CultureInfo("en-US"), false, true, new string[]{"dlbmol"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmountOfSubstanceUnit.Kilomole, new CultureInfo("en-US"), false, true, new string[]{"kmol"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmountOfSubstanceUnit.KilopoundMole, new CultureInfo("en-US"), false, true, new string[]{"klbmol"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmountOfSubstanceUnit.Megamole, new CultureInfo("en-US"), false, true, new string[]{"Mmol"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmountOfSubstanceUnit.Micromole, new CultureInfo("en-US"), false, true, new string[]{"µmol"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmountOfSubstanceUnit.MicropoundMole, new CultureInfo("en-US"), false, true, new string[]{"µlbmol"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmountOfSubstanceUnit.Millimole, new CultureInfo("en-US"), false, true, new string[]{"mmol"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmountOfSubstanceUnit.MillipoundMole, new CultureInfo("en-US"), false, true, new string[]{"mlbmol"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmountOfSubstanceUnit.Mole, new CultureInfo("en-US"), false, true, new string[]{"mol"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmountOfSubstanceUnit.Nanomole, new CultureInfo("en-US"), false, true, new string[]{"nmol"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmountOfSubstanceUnit.NanopoundMole, new CultureInfo("en-US"), false, true, new string[]{"nlbmol"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmountOfSubstanceUnit.PoundMole, new CultureInfo("en-US"), false, true, new string[]{"lbmol"});
- }
-
///
/// Get unit abbreviation string.
///
diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs
index 969d381adb..65093864f8 100644
--- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs
@@ -65,10 +65,10 @@ static AmplitudeRatio()
Info = new QuantityInfo("AmplitudeRatio",
new UnitInfo[]
{
- new UnitInfo(AmplitudeRatioUnit.DecibelMicrovolt, "DecibelMicrovolts", BaseUnits.Undefined),
- new UnitInfo(AmplitudeRatioUnit.DecibelMillivolt, "DecibelMillivolts", BaseUnits.Undefined),
- new UnitInfo(AmplitudeRatioUnit.DecibelUnloaded, "DecibelsUnloaded", BaseUnits.Undefined),
- new UnitInfo(AmplitudeRatioUnit.DecibelVolt, "DecibelVolts", BaseUnits.Undefined),
+ new UnitInfo(AmplitudeRatioUnit.DecibelMicrovolt, "DecibelMicrovolts", BaseUnits.Undefined, "AmplitudeRatio"),
+ new UnitInfo(AmplitudeRatioUnit.DecibelMillivolt, "DecibelMillivolts", BaseUnits.Undefined, "AmplitudeRatio"),
+ new UnitInfo(AmplitudeRatioUnit.DecibelUnloaded, "DecibelsUnloaded", BaseUnits.Undefined, "AmplitudeRatio"),
+ new UnitInfo(AmplitudeRatioUnit.DecibelVolt, "DecibelVolts", BaseUnits.Undefined, "AmplitudeRatio"),
},
BaseUnit, Zero, BaseDimensions);
@@ -216,14 +216,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
unitConverter.SetConversionFunction(AmplitudeRatioUnit.DecibelVolt, AmplitudeRatioUnit.DecibelUnloaded, quantity => quantity.ToUnit(AmplitudeRatioUnit.DecibelUnloaded));
}
- internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbreviationsCache)
- {
- unitAbbreviationsCache.PerformAbbreviationMapping(AmplitudeRatioUnit.DecibelMicrovolt, new CultureInfo("en-US"), false, true, new string[]{"dBµV"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmplitudeRatioUnit.DecibelMillivolt, new CultureInfo("en-US"), false, true, new string[]{"dBmV"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmplitudeRatioUnit.DecibelUnloaded, new CultureInfo("en-US"), false, true, new string[]{"dBu"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AmplitudeRatioUnit.DecibelVolt, new CultureInfo("en-US"), false, true, new string[]{"dBV"});
- }
-
///
/// Get unit abbreviation string.
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs
index b4cda3142d..3e1d8b3176 100644
--- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs
@@ -65,22 +65,22 @@ static Angle()
Info = new QuantityInfo("Angle",
new UnitInfo[]
{
- new UnitInfo(AngleUnit.Arcminute, "Arcminutes", BaseUnits.Undefined),
- new UnitInfo(AngleUnit.Arcsecond, "Arcseconds", BaseUnits.Undefined),
- new UnitInfo(AngleUnit.Centiradian, "Centiradians", BaseUnits.Undefined),
- new UnitInfo(AngleUnit.Deciradian, "Deciradians", BaseUnits.Undefined),
- new UnitInfo(AngleUnit.Degree, "Degrees", BaseUnits.Undefined),
- new UnitInfo(AngleUnit.Gradian, "Gradians", BaseUnits.Undefined),
- new UnitInfo(AngleUnit.Microdegree, "Microdegrees", BaseUnits.Undefined),
- new UnitInfo(AngleUnit.Microradian, "Microradians", BaseUnits.Undefined),
- new UnitInfo(AngleUnit.Millidegree, "Millidegrees", BaseUnits.Undefined),
- new UnitInfo(AngleUnit.Milliradian, "Milliradians", BaseUnits.Undefined),
- new UnitInfo(AngleUnit.Nanodegree, "Nanodegrees", BaseUnits.Undefined),
- new UnitInfo(AngleUnit.Nanoradian, "Nanoradians", BaseUnits.Undefined),
- new UnitInfo(AngleUnit.NatoMil, "NatoMils", BaseUnits.Undefined),
- new UnitInfo(AngleUnit.Radian, "Radians", BaseUnits.Undefined),
- new UnitInfo(AngleUnit.Revolution, "Revolutions", BaseUnits.Undefined),
- new UnitInfo(AngleUnit.Tilt, "Tilt", BaseUnits.Undefined),
+ new UnitInfo(AngleUnit.Arcminute, "Arcminutes", BaseUnits.Undefined, "Angle"),
+ new UnitInfo(AngleUnit.Arcsecond, "Arcseconds", BaseUnits.Undefined, "Angle"),
+ new UnitInfo(AngleUnit.Centiradian, "Centiradians", BaseUnits.Undefined, "Angle"),
+ new UnitInfo(AngleUnit.Deciradian, "Deciradians", BaseUnits.Undefined, "Angle"),
+ new UnitInfo(AngleUnit.Degree, "Degrees", BaseUnits.Undefined, "Angle"),
+ new UnitInfo(AngleUnit.Gradian, "Gradians", BaseUnits.Undefined, "Angle"),
+ new UnitInfo(AngleUnit.Microdegree, "Microdegrees", BaseUnits.Undefined, "Angle"),
+ new UnitInfo(AngleUnit.Microradian, "Microradians", BaseUnits.Undefined, "Angle"),
+ new UnitInfo(AngleUnit.Millidegree, "Millidegrees", BaseUnits.Undefined, "Angle"),
+ new UnitInfo(AngleUnit.Milliradian, "Milliradians", BaseUnits.Undefined, "Angle"),
+ new UnitInfo(AngleUnit.Nanodegree, "Nanodegrees", BaseUnits.Undefined, "Angle"),
+ new UnitInfo(AngleUnit.Nanoradian, "Nanoradians", BaseUnits.Undefined, "Angle"),
+ new UnitInfo(AngleUnit.NatoMil, "NatoMils", BaseUnits.Undefined, "Angle"),
+ new UnitInfo(AngleUnit.Radian, "Radians", BaseUnits.Undefined, "Angle"),
+ new UnitInfo(AngleUnit.Revolution, "Revolutions", BaseUnits.Undefined, "Angle"),
+ new UnitInfo(AngleUnit.Tilt, "Tilt", BaseUnits.Undefined, "Angle"),
},
BaseUnit, Zero, BaseDimensions);
@@ -312,38 +312,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
unitConverter.SetConversionFunction(AngleUnit.Degree, AngleUnit.Tilt, quantity => quantity.ToUnit(AngleUnit.Tilt));
}
- internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbreviationsCache)
- {
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Arcminute, new CultureInfo("en-US"), false, true, new string[]{"'", "arcmin", "amin", "min"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Arcsecond, new CultureInfo("en-US"), false, true, new string[]{"″", "arcsec", "asec", "sec"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Centiradian, new CultureInfo("en-US"), false, true, new string[]{"crad"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Centiradian, new CultureInfo("ru-RU"), false, true, new string[]{"срад"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Deciradian, new CultureInfo("en-US"), false, true, new string[]{"drad"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Deciradian, new CultureInfo("ru-RU"), false, true, new string[]{"драд"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Degree, new CultureInfo("en-US"), false, true, new string[]{"°", "deg"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Degree, new CultureInfo("ru-RU"), false, true, new string[]{"°"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Gradian, new CultureInfo("en-US"), false, true, new string[]{"g"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Gradian, new CultureInfo("ru-RU"), false, true, new string[]{"g"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Microdegree, new CultureInfo("en-US"), false, true, new string[]{"µ°", "µdeg"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Microdegree, new CultureInfo("ru-RU"), false, true, new string[]{"мк°"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Microradian, new CultureInfo("en-US"), false, true, new string[]{"µrad"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Microradian, new CultureInfo("ru-RU"), false, true, new string[]{"мкрад"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Millidegree, new CultureInfo("en-US"), false, true, new string[]{"m°", "mdeg"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Millidegree, new CultureInfo("ru-RU"), false, true, new string[]{"м°"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Milliradian, new CultureInfo("en-US"), false, true, new string[]{"mrad"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Milliradian, new CultureInfo("ru-RU"), false, true, new string[]{"мрад"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Nanodegree, new CultureInfo("en-US"), false, true, new string[]{"n°", "ndeg"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Nanodegree, new CultureInfo("ru-RU"), false, true, new string[]{"н°"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Nanoradian, new CultureInfo("en-US"), false, true, new string[]{"nrad"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Nanoradian, new CultureInfo("ru-RU"), false, true, new string[]{"нрад"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.NatoMil, new CultureInfo("en-US"), false, true, new string[]{"mil"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Radian, new CultureInfo("en-US"), false, true, new string[]{"rad"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Radian, new CultureInfo("ru-RU"), false, true, new string[]{"рад"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Revolution, new CultureInfo("en-US"), false, true, new string[]{"r"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Revolution, new CultureInfo("ru-RU"), false, true, new string[]{"r"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AngleUnit.Tilt, new CultureInfo("en-US"), false, true, new string[]{"sin(θ)"});
- }
-
///
/// Get unit abbreviation string.
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs
index ced57734a1..9d9577f0ce 100644
--- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs
@@ -65,9 +65,9 @@ static ApparentEnergy()
Info = new QuantityInfo("ApparentEnergy",
new UnitInfo[]
{
- new UnitInfo(ApparentEnergyUnit.KilovoltampereHour, "KilovoltampereHours", BaseUnits.Undefined),
- new UnitInfo(ApparentEnergyUnit.MegavoltampereHour, "MegavoltampereHours", BaseUnits.Undefined),
- new UnitInfo(ApparentEnergyUnit.VoltampereHour, "VoltampereHours", BaseUnits.Undefined),
+ new UnitInfo(ApparentEnergyUnit.KilovoltampereHour, "KilovoltampereHours", BaseUnits.Undefined, "ApparentEnergy"),
+ new UnitInfo(ApparentEnergyUnit.MegavoltampereHour, "MegavoltampereHours", BaseUnits.Undefined, "ApparentEnergy"),
+ new UnitInfo(ApparentEnergyUnit.VoltampereHour, "VoltampereHours", BaseUnits.Undefined, "ApparentEnergy"),
},
BaseUnit, Zero, BaseDimensions);
@@ -208,13 +208,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
unitConverter.SetConversionFunction(ApparentEnergyUnit.VoltampereHour, ApparentEnergyUnit.MegavoltampereHour, quantity => quantity.ToUnit(ApparentEnergyUnit.MegavoltampereHour));
}
- internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbreviationsCache)
- {
- unitAbbreviationsCache.PerformAbbreviationMapping(ApparentEnergyUnit.KilovoltampereHour, new CultureInfo("en-US"), false, true, new string[]{"kVAh"});
- unitAbbreviationsCache.PerformAbbreviationMapping(ApparentEnergyUnit.MegavoltampereHour, new CultureInfo("en-US"), false, true, new string[]{"MVAh"});
- unitAbbreviationsCache.PerformAbbreviationMapping(ApparentEnergyUnit.VoltampereHour, new CultureInfo("en-US"), false, true, new string[]{"VAh"});
- }
-
///
/// Get unit abbreviation string.
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs
index b2d646fb8c..0643ea8428 100644
--- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs
@@ -65,12 +65,12 @@ static ApparentPower()
Info = new QuantityInfo("ApparentPower",
new UnitInfo[]
{
- new UnitInfo(ApparentPowerUnit.Gigavoltampere, "Gigavoltamperes", BaseUnits.Undefined),
- new UnitInfo(ApparentPowerUnit.Kilovoltampere, "Kilovoltamperes", BaseUnits.Undefined),
- new UnitInfo(ApparentPowerUnit.Megavoltampere, "Megavoltamperes", BaseUnits.Undefined),
- new UnitInfo(ApparentPowerUnit.Microvoltampere, "Microvoltamperes", BaseUnits.Undefined),
- new UnitInfo(ApparentPowerUnit.Millivoltampere, "Millivoltamperes", BaseUnits.Undefined),
- new UnitInfo(ApparentPowerUnit.Voltampere, "Voltamperes", BaseUnits.Undefined),
+ new UnitInfo(ApparentPowerUnit.Gigavoltampere, "Gigavoltamperes", BaseUnits.Undefined, "ApparentPower"),
+ new UnitInfo(ApparentPowerUnit.Kilovoltampere, "Kilovoltamperes", BaseUnits.Undefined, "ApparentPower"),
+ new UnitInfo(ApparentPowerUnit.Megavoltampere, "Megavoltamperes", BaseUnits.Undefined, "ApparentPower"),
+ new UnitInfo(ApparentPowerUnit.Microvoltampere, "Microvoltamperes", BaseUnits.Undefined, "ApparentPower"),
+ new UnitInfo(ApparentPowerUnit.Millivoltampere, "Millivoltamperes", BaseUnits.Undefined, "ApparentPower"),
+ new UnitInfo(ApparentPowerUnit.Voltampere, "Voltamperes", BaseUnits.Undefined, "ApparentPower"),
},
BaseUnit, Zero, BaseDimensions);
@@ -232,16 +232,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
unitConverter.SetConversionFunction(ApparentPowerUnit.Voltampere, ApparentPowerUnit.Millivoltampere, quantity => quantity.ToUnit(ApparentPowerUnit.Millivoltampere));
}
- internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbreviationsCache)
- {
- unitAbbreviationsCache.PerformAbbreviationMapping(ApparentPowerUnit.Gigavoltampere, new CultureInfo("en-US"), false, true, new string[]{"GVA"});
- unitAbbreviationsCache.PerformAbbreviationMapping(ApparentPowerUnit.Kilovoltampere, new CultureInfo("en-US"), false, true, new string[]{"kVA"});
- unitAbbreviationsCache.PerformAbbreviationMapping(ApparentPowerUnit.Megavoltampere, new CultureInfo("en-US"), false, true, new string[]{"MVA"});
- unitAbbreviationsCache.PerformAbbreviationMapping(ApparentPowerUnit.Microvoltampere, new CultureInfo("en-US"), false, true, new string[]{"µVA"});
- unitAbbreviationsCache.PerformAbbreviationMapping(ApparentPowerUnit.Millivoltampere, new CultureInfo("en-US"), false, true, new string[]{"mVA"});
- unitAbbreviationsCache.PerformAbbreviationMapping(ApparentPowerUnit.Voltampere, new CultureInfo("en-US"), false, true, new string[]{"VA"});
- }
-
///
/// Get unit abbreviation string.
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs
index 368dc2eeed..ce5d25a380 100644
--- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs
@@ -65,20 +65,20 @@ static Area()
Info = new QuantityInfo("Area",
new UnitInfo[]
{
- new UnitInfo(AreaUnit.Acre, "Acres", BaseUnits.Undefined),
- new UnitInfo(AreaUnit.Hectare, "Hectares", BaseUnits.Undefined),
- new UnitInfo(AreaUnit.SquareCentimeter, "SquareCentimeters", new BaseUnits(length: LengthUnit.Centimeter)),
- new UnitInfo(AreaUnit.SquareDecimeter, "SquareDecimeters", new BaseUnits(length: LengthUnit.Decimeter)),
- new UnitInfo(AreaUnit.SquareFoot, "SquareFeet", new BaseUnits(length: LengthUnit.Foot)),
- new UnitInfo(AreaUnit.SquareInch, "SquareInches", new BaseUnits(length: LengthUnit.Inch)),
- new UnitInfo(AreaUnit.SquareKilometer, "SquareKilometers", new BaseUnits(length: LengthUnit.Kilometer)),
- new UnitInfo(AreaUnit.SquareMeter, "SquareMeters", new BaseUnits(length: LengthUnit.Meter)),
- new UnitInfo(AreaUnit.SquareMicrometer, "SquareMicrometers", new BaseUnits(length: LengthUnit.Micrometer)),
- new UnitInfo(AreaUnit.SquareMile, "SquareMiles", new BaseUnits(length: LengthUnit.Mile)),
- new UnitInfo(AreaUnit.SquareMillimeter, "SquareMillimeters", new BaseUnits(length: LengthUnit.Millimeter)),
- new UnitInfo(AreaUnit.SquareNauticalMile, "SquareNauticalMiles", BaseUnits.Undefined),
- new UnitInfo(AreaUnit.SquareYard, "SquareYards", new BaseUnits(length: LengthUnit.Yard)),
- new UnitInfo(AreaUnit.UsSurveySquareFoot, "UsSurveySquareFeet", new BaseUnits(length: LengthUnit.UsSurveyFoot)),
+ new UnitInfo(AreaUnit.Acre, "Acres", BaseUnits.Undefined, "Area"),
+ new UnitInfo(AreaUnit.Hectare, "Hectares", BaseUnits.Undefined, "Area"),
+ new UnitInfo(AreaUnit.SquareCentimeter, "SquareCentimeters", new BaseUnits(length: LengthUnit.Centimeter), "Area"),
+ new UnitInfo(AreaUnit.SquareDecimeter, "SquareDecimeters", new BaseUnits(length: LengthUnit.Decimeter), "Area"),
+ new UnitInfo(AreaUnit.SquareFoot, "SquareFeet", new BaseUnits(length: LengthUnit.Foot), "Area"),
+ new UnitInfo(AreaUnit.SquareInch, "SquareInches", new BaseUnits(length: LengthUnit.Inch), "Area"),
+ new UnitInfo(AreaUnit.SquareKilometer, "SquareKilometers", new BaseUnits(length: LengthUnit.Kilometer), "Area"),
+ new UnitInfo(AreaUnit.SquareMeter, "SquareMeters", new BaseUnits(length: LengthUnit.Meter), "Area"),
+ new UnitInfo(AreaUnit.SquareMicrometer, "SquareMicrometers", new BaseUnits(length: LengthUnit.Micrometer), "Area"),
+ new UnitInfo(AreaUnit.SquareMile, "SquareMiles", new BaseUnits(length: LengthUnit.Mile), "Area"),
+ new UnitInfo(AreaUnit.SquareMillimeter, "SquareMillimeters", new BaseUnits(length: LengthUnit.Millimeter), "Area"),
+ new UnitInfo(AreaUnit.SquareNauticalMile, "SquareNauticalMiles", BaseUnits.Undefined, "Area"),
+ new UnitInfo(AreaUnit.SquareYard, "SquareYards", new BaseUnits(length: LengthUnit.Yard), "Area"),
+ new UnitInfo(AreaUnit.UsSurveySquareFoot, "UsSurveySquareFeet", new BaseUnits(length: LengthUnit.UsSurveyFoot), "Area"),
},
BaseUnit, Zero, BaseDimensions);
@@ -296,51 +296,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
unitConverter.SetConversionFunction(AreaUnit.SquareMeter, AreaUnit.UsSurveySquareFoot, quantity => quantity.ToUnit(AreaUnit.UsSurveySquareFoot));
}
- internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbreviationsCache)
- {
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.Acre, new CultureInfo("en-US"), false, true, new string[]{"ac"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.Acre, new CultureInfo("ru-RU"), false, true, new string[]{"акр"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.Acre, new CultureInfo("zh-CN"), false, true, new string[]{"英亩"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.Hectare, new CultureInfo("en-US"), false, true, new string[]{"ha"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.Hectare, new CultureInfo("ru-RU"), false, true, new string[]{"га"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.Hectare, new CultureInfo("zh-CN"), false, true, new string[]{"英亩"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareCentimeter, new CultureInfo("en-US"), false, true, new string[]{"cm²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareCentimeter, new CultureInfo("ru-RU"), false, true, new string[]{"см²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareCentimeter, new CultureInfo("zh-CN"), false, true, new string[]{"平方厘米"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareDecimeter, new CultureInfo("en-US"), false, true, new string[]{"dm²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareDecimeter, new CultureInfo("ru-RU"), false, true, new string[]{"дм²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareDecimeter, new CultureInfo("zh-CN"), false, true, new string[]{"平方分米"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareFoot, new CultureInfo("en-US"), false, true, new string[]{"ft²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareFoot, new CultureInfo("ru-RU"), false, true, new string[]{"фут²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareFoot, new CultureInfo("zh-CN"), false, true, new string[]{"平方英尺"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareInch, new CultureInfo("en-US"), false, true, new string[]{"in²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareInch, new CultureInfo("ru-RU"), false, true, new string[]{"дюйм²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareInch, new CultureInfo("zh-CN"), false, true, new string[]{"平方英寸"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareKilometer, new CultureInfo("en-US"), false, true, new string[]{"km²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareKilometer, new CultureInfo("ru-RU"), false, true, new string[]{"км²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareKilometer, new CultureInfo("zh-CN"), false, true, new string[]{"平方公里"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareMeter, new CultureInfo("en-US"), false, true, new string[]{"m²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareMeter, new CultureInfo("ru-RU"), false, true, new string[]{"м²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareMeter, new CultureInfo("zh-CN"), false, true, new string[]{"平方米"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareMicrometer, new CultureInfo("en-US"), false, true, new string[]{"µm²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareMicrometer, new CultureInfo("ru-RU"), false, true, new string[]{"мкм²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareMicrometer, new CultureInfo("zh-CN"), false, true, new string[]{"平方微米"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareMile, new CultureInfo("en-US"), false, true, new string[]{"mi²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareMile, new CultureInfo("ru-RU"), false, true, new string[]{"миля²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareMile, new CultureInfo("zh-CN"), false, true, new string[]{"平方英里"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareMillimeter, new CultureInfo("en-US"), false, true, new string[]{"mm²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareMillimeter, new CultureInfo("ru-RU"), false, true, new string[]{"мм²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareMillimeter, new CultureInfo("zh-CN"), false, true, new string[]{"平方毫米"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareNauticalMile, new CultureInfo("en-US"), false, true, new string[]{"nmi²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareNauticalMile, new CultureInfo("ru-RU"), false, true, new string[]{"морск.миля²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareNauticalMile, new CultureInfo("zh-CN"), false, true, new string[]{"平方海里"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareYard, new CultureInfo("en-US"), false, true, new string[]{"yd²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareYard, new CultureInfo("ru-RU"), false, true, new string[]{"ярд²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.SquareYard, new CultureInfo("zh-CN"), false, true, new string[]{"平方码"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.UsSurveySquareFoot, new CultureInfo("en-US"), false, true, new string[]{"ft² (US)"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaUnit.UsSurveySquareFoot, new CultureInfo("ru-RU"), false, true, new string[]{"фут² (US)"});
- }
-
///
/// Get unit abbreviation string.
///
diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs
index bd3eb2c19a..08ea8e79b1 100644
--- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs
@@ -65,9 +65,9 @@ static AreaDensity()
Info = new QuantityInfo("AreaDensity",
new UnitInfo[]
{
- new UnitInfo(AreaDensityUnit.GramPerSquareMeter, "GramsPerSquareMeter", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Gram)),
- new UnitInfo(AreaDensityUnit.KilogramPerSquareMeter, "KilogramsPerSquareMeter", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram)),
- new UnitInfo(AreaDensityUnit.MilligramPerSquareMeter, "MilligramsPerSquareMeter", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Milligram)),
+ new UnitInfo(AreaDensityUnit.GramPerSquareMeter, "GramsPerSquareMeter", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Gram), "AreaDensity"),
+ new UnitInfo(AreaDensityUnit.KilogramPerSquareMeter, "KilogramsPerSquareMeter", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram), "AreaDensity"),
+ new UnitInfo(AreaDensityUnit.MilligramPerSquareMeter, "MilligramsPerSquareMeter", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Milligram), "AreaDensity"),
},
BaseUnit, Zero, BaseDimensions);
@@ -208,13 +208,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
unitConverter.SetConversionFunction(AreaDensityUnit.KilogramPerSquareMeter, AreaDensityUnit.MilligramPerSquareMeter, quantity => quantity.ToUnit(AreaDensityUnit.MilligramPerSquareMeter));
}
- internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbreviationsCache)
- {
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaDensityUnit.GramPerSquareMeter, new CultureInfo("en-US"), false, true, new string[]{"g/m²", "gsm"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaDensityUnit.KilogramPerSquareMeter, new CultureInfo("en-US"), false, true, new string[]{"kg/m²"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaDensityUnit.MilligramPerSquareMeter, new CultureInfo("en-US"), false, true, new string[]{"mg/m²"});
- }
-
///
/// Get unit abbreviation string.
///
diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs
index 100e1f3a4e..71227c04c2 100644
--- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs
@@ -65,12 +65,12 @@ static AreaMomentOfInertia()
Info = new QuantityInfo("AreaMomentOfInertia",
new UnitInfo[]
{
- new UnitInfo(AreaMomentOfInertiaUnit.CentimeterToTheFourth, "CentimetersToTheFourth", new BaseUnits(length: LengthUnit.Centimeter)),
- new UnitInfo(AreaMomentOfInertiaUnit.DecimeterToTheFourth, "DecimetersToTheFourth", new BaseUnits(length: LengthUnit.Decimeter)),
- new UnitInfo(AreaMomentOfInertiaUnit.FootToTheFourth, "FeetToTheFourth", new BaseUnits(length: LengthUnit.Foot)),
- new UnitInfo(AreaMomentOfInertiaUnit.InchToTheFourth, "InchesToTheFourth", new BaseUnits(length: LengthUnit.Inch)),
- new UnitInfo(AreaMomentOfInertiaUnit.MeterToTheFourth, "MetersToTheFourth", new BaseUnits(length: LengthUnit.Meter)),
- new UnitInfo(AreaMomentOfInertiaUnit.MillimeterToTheFourth, "MillimetersToTheFourth", new BaseUnits(length: LengthUnit.Millimeter)),
+ new UnitInfo(AreaMomentOfInertiaUnit.CentimeterToTheFourth, "CentimetersToTheFourth", new BaseUnits(length: LengthUnit.Centimeter), "AreaMomentOfInertia"),
+ new UnitInfo(AreaMomentOfInertiaUnit.DecimeterToTheFourth, "DecimetersToTheFourth", new BaseUnits(length: LengthUnit.Decimeter), "AreaMomentOfInertia"),
+ new UnitInfo(AreaMomentOfInertiaUnit.FootToTheFourth, "FeetToTheFourth", new BaseUnits(length: LengthUnit.Foot), "AreaMomentOfInertia"),
+ new UnitInfo(AreaMomentOfInertiaUnit.InchToTheFourth, "InchesToTheFourth", new BaseUnits(length: LengthUnit.Inch), "AreaMomentOfInertia"),
+ new UnitInfo(AreaMomentOfInertiaUnit.MeterToTheFourth, "MetersToTheFourth", new BaseUnits(length: LengthUnit.Meter), "AreaMomentOfInertia"),
+ new UnitInfo(AreaMomentOfInertiaUnit.MillimeterToTheFourth, "MillimetersToTheFourth", new BaseUnits(length: LengthUnit.Millimeter), "AreaMomentOfInertia"),
},
BaseUnit, Zero, BaseDimensions);
@@ -232,16 +232,6 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
unitConverter.SetConversionFunction(AreaMomentOfInertiaUnit.MeterToTheFourth, AreaMomentOfInertiaUnit.MillimeterToTheFourth, quantity => quantity.ToUnit(AreaMomentOfInertiaUnit.MillimeterToTheFourth));
}
- internal static void MapGeneratedLocalizations(UnitAbbreviationsCache unitAbbreviationsCache)
- {
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaMomentOfInertiaUnit.CentimeterToTheFourth, new CultureInfo("en-US"), false, true, new string[]{"cm⁴", "cm^4"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaMomentOfInertiaUnit.DecimeterToTheFourth, new CultureInfo("en-US"), false, true, new string[]{"dm⁴", "dm^4"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaMomentOfInertiaUnit.FootToTheFourth, new CultureInfo("en-US"), false, true, new string[]{"ft⁴", "ft^4"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaMomentOfInertiaUnit.InchToTheFourth, new CultureInfo("en-US"), false, true, new string[]{"in⁴", "in^4"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaMomentOfInertiaUnit.MeterToTheFourth, new CultureInfo("en-US"), false, true, new string[]{"m⁴", "m^4"});
- unitAbbreviationsCache.PerformAbbreviationMapping(AreaMomentOfInertiaUnit.MillimeterToTheFourth, new CultureInfo("en-US"), false, true, new string[]{"mm⁴", "mm^4"});
- }
-
///
/// Get unit abbreviation string.
///
diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs
index 6444f5e964..1bdf73354a 100644
--- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs
@@ -69,32 +69,32 @@ static BitRate()
Info = new QuantityInfo("BitRate",
new UnitInfo[]
{
- new UnitInfo(BitRateUnit.BitPerSecond, "BitsPerSecond", BaseUnits.Undefined),
- new UnitInfo(BitRateUnit.BytePerSecond, "BytesPerSecond", BaseUnits.Undefined),
- new UnitInfo(BitRateUnit.ExabitPerSecond, "ExabitsPerSecond", BaseUnits.Undefined),
- new UnitInfo(BitRateUnit.ExabytePerSecond, "ExabytesPerSecond", BaseUnits.Undefined),
- new UnitInfo(BitRateUnit.ExbibitPerSecond, "ExbibitsPerSecond", BaseUnits.Undefined),
- new UnitInfo(BitRateUnit.ExbibytePerSecond, "ExbibytesPerSecond", BaseUnits.Undefined),
- new UnitInfo(BitRateUnit.GibibitPerSecond, "GibibitsPerSecond", BaseUnits.Undefined),
- new UnitInfo(BitRateUnit.GibibytePerSecond, "GibibytesPerSecond", BaseUnits.Undefined),
- new UnitInfo(BitRateUnit.GigabitPerSecond, "GigabitsPerSecond", BaseUnits.Undefined),
- new UnitInfo(BitRateUnit.GigabytePerSecond, "GigabytesPerSecond", BaseUnits.Undefined),
- new UnitInfo(BitRateUnit.KibibitPerSecond, "KibibitsPerSecond", BaseUnits.Undefined),
- new UnitInfo(BitRateUnit.KibibytePerSecond, "KibibytesPerSecond", BaseUnits.Undefined),
- new UnitInfo(BitRateUnit.KilobitPerSecond, "KilobitsPerSecond", BaseUnits.Undefined),
- new UnitInfo(BitRateUnit.KilobytePerSecond, "KilobytesPerSecond", BaseUnits.Undefined),
- new UnitInfo(BitRateUnit.MebibitPerSecond, "MebibitsPerSecond", BaseUnits.Undefined),
- new UnitInfo(BitRateUnit.MebibytePerSecond, "MebibytesPerSecond", BaseUnits.Undefined),
- new UnitInfo