diff --git a/UnitsNet/UnitInfo.cs b/UnitsNet/UnitInfo.cs index 9398462427..9f42a1e23e 100644 --- a/UnitsNet/UnitInfo.cs +++ b/UnitsNet/UnitInfo.cs @@ -23,11 +23,12 @@ public class UnitInfo /// The enum value for this class, for example . /// The plural name of the unit, such as "Centimeters". /// The for this unit. + [Obsolete("Use the constructor that also takes a quantityName parameter.")] public UnitInfo(Enum value, string pluralName, BaseUnits baseUnits) { Value = value ?? throw new ArgumentNullException(nameof(value)); Name = value.ToString(); - PluralName = pluralName; + PluralName = pluralName ?? throw new ArgumentNullException(nameof(pluralName)); BaseUnits = baseUnits ?? throw new ArgumentNullException(nameof(baseUnits)); } @@ -38,10 +39,13 @@ public UnitInfo(Enum value, string pluralName, BaseUnits baseUnits) /// The plural name of the unit, such as "Centimeters". /// The for this unit. /// The quantity name that this unit is for. - internal UnitInfo(Enum value, string pluralName, BaseUnits baseUnits, string quantityName) : - this(value, pluralName, baseUnits) + public UnitInfo(Enum value, string pluralName, BaseUnits baseUnits, string quantityName) { - QuantityName = quantityName; + Value = value ?? throw new ArgumentNullException(nameof(value)); + Name = value.ToString(); + PluralName = pluralName ?? throw new ArgumentNullException(nameof(pluralName)); + BaseUnits = baseUnits ?? throw new ArgumentNullException(nameof(baseUnits)); + QuantityName = quantityName ?? throw new ArgumentNullException(nameof(quantityName)); } /// @@ -81,6 +85,7 @@ public class UnitInfo : UnitInfo where TUnit : Enum { /// + [Obsolete("Use the constructor that also takes a quantityName parameter.")] public UnitInfo(TUnit value, string pluralName, BaseUnits baseUnits) : base(value, pluralName, baseUnits) { @@ -88,7 +93,7 @@ public UnitInfo(TUnit value, string pluralName, BaseUnits baseUnits) : } /// - internal UnitInfo(TUnit value, string pluralName, BaseUnits baseUnits, string quantityName) : + public UnitInfo(TUnit value, string pluralName, BaseUnits baseUnits, string quantityName) : base(value, pluralName, baseUnits, quantityName) { Value = value;