diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs index bb0f3f3e4c..b9a6039db9 100644 --- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs @@ -290,25 +290,30 @@ private void GenerateProperties() /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public {_unitEnumName} Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo<{_unitEnumName}> QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => {_quantity.Name}.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion "); } @@ -1167,7 +1172,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); }} - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1178,16 +1183,13 @@ public string ToString(string? format) return ToString(format, null); }} - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) {{ - return QuantityFormatter.Format<{_unitEnumName}>(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); }} #endregion diff --git a/UnitsNet.Benchmark/Conversions/ToString/ToStringWithDefaultPrecisionBenchmarks.cs b/UnitsNet.Benchmark/Conversions/ToString/ToStringWithDefaultPrecisionBenchmarks.cs index 6d0560ebfb..5b1381e91f 100644 --- a/UnitsNet.Benchmark/Conversions/ToString/ToStringWithDefaultPrecisionBenchmarks.cs +++ b/UnitsNet.Benchmark/Conversions/ToString/ToStringWithDefaultPrecisionBenchmarks.cs @@ -9,7 +9,7 @@ namespace UnitsNet.Benchmark.Conversions.ToString; [MemoryDiagnoser] [SimpleJob(RuntimeMoniker.Net48)] -[SimpleJob(RuntimeMoniker.Net80)] +[SimpleJob(RuntimeMoniker.Net90)] public class ToStringWithDefaultPrecisionBenchmarks { private static readonly double Value = 123.456; diff --git a/UnitsNet.Benchmark/Enums/UnitKeyEqualsBenchmarks.cs b/UnitsNet.Benchmark/Enums/UnitKeyEqualsBenchmarks.cs index e763b8233a..6cbd33683f 100644 --- a/UnitsNet.Benchmark/Enums/UnitKeyEqualsBenchmarks.cs +++ b/UnitsNet.Benchmark/Enums/UnitKeyEqualsBenchmarks.cs @@ -16,11 +16,11 @@ public class UnitKeyEqualsBenchmarks private static readonly UnitKey UnitKey = UnitKey.ForUnit(VolumeUnit.CubicMeter); private static readonly UnitKey OtherUnitKey = UnitKey.ForUnit(VolumeUnit.AcreFoot); - private readonly Type OtherUnitType = UnitKey.UnitType; - private readonly int OtherUnitValue = UnitKey.UnitValue; + private readonly Type OtherUnitType = UnitKey.UnitEnumType; + private readonly int OtherUnitValue = UnitKey.UnitEnumValue; - private readonly Type UnitType = UnitKey.UnitType; - private readonly int UnitValue = UnitKey.UnitValue; + private readonly Type UnitType = UnitKey.UnitEnumType; + private readonly int UnitValue = UnitKey.UnitEnumValue; [Benchmark(Baseline = true)] public bool EqualsRecord() diff --git a/UnitsNet.Benchmark/Enums/UnitKeyHashCodeBenchmarks.cs b/UnitsNet.Benchmark/Enums/UnitKeyHashCodeBenchmarks.cs index cdc09972c3..66c707f8be 100644 --- a/UnitsNet.Benchmark/Enums/UnitKeyHashCodeBenchmarks.cs +++ b/UnitsNet.Benchmark/Enums/UnitKeyHashCodeBenchmarks.cs @@ -17,8 +17,8 @@ public class UnitKeyHashCodeBenchmarks private static readonly UnitKey UnitKey = UnitKey.ForUnit(VolumeUnit.CubicMeter); - private readonly Type UnitType = UnitKey.UnitType; - private readonly int UnitValue = UnitKey.UnitValue; + private readonly Type UnitType = UnitKey.UnitEnumType; + private readonly int UnitValue = UnitKey.UnitEnumValue; [Benchmark(Baseline = true)] public int GetHashCodeRecord() diff --git a/UnitsNet.Benchmark/Enums/UnitKeyToEnumBenchmarks.cs b/UnitsNet.Benchmark/Enums/UnitKeyToEnumBenchmarks.cs index d70e9db227..719f81b3ce 100644 --- a/UnitsNet.Benchmark/Enums/UnitKeyToEnumBenchmarks.cs +++ b/UnitsNet.Benchmark/Enums/UnitKeyToEnumBenchmarks.cs @@ -23,7 +23,7 @@ public int ManualCast() var total = 0; for (var i = 0; i < NbIterations; i++) { - if ((MassUnit)unitKey.UnitValue == MassUnit.Gram) + if ((MassUnit)unitKey.UnitEnumValue == MassUnit.Gram) { total++; } diff --git a/UnitsNet.Tests/CustomQuantities/HowMuch.cs b/UnitsNet.Tests/CustomQuantities/HowMuch.cs index 7dbbc8d40b..40ed9752e6 100644 --- a/UnitsNet.Tests/CustomQuantities/HowMuch.cs +++ b/UnitsNet.Tests/CustomQuantities/HowMuch.cs @@ -49,6 +49,11 @@ QuantityInfo IQuantity.QuantityInfo { get { return Info; } } + + public UnitKey UnitKey + { + get => UnitKey.ForUnit(Unit); + } public double As(Enum unit) => Convert.ToDouble(unit); diff --git a/UnitsNet.Tests/DummyIQuantity.cs b/UnitsNet.Tests/DummyIQuantity.cs deleted file mode 100644 index cc15ec1af4..0000000000 --- a/UnitsNet.Tests/DummyIQuantity.cs +++ /dev/null @@ -1,34 +0,0 @@ -#nullable enable -using System; - -namespace UnitsNet.Tests -{ - internal class DummyIQuantity : IQuantity - { - public BaseDimensions Dimensions => throw new NotImplementedException(); - - public QuantityInfo QuantityInfo => throw new NotImplementedException(); - - bool IQuantity.Equals(IQuantity? other, IQuantity tolerance) => throw new NotImplementedException(); - - public Enum Unit => throw new NotImplementedException(); - - public double Value => throw new NotImplementedException(); - - public double As(Enum unit ) => throw new NotImplementedException(); - - public double As(UnitSystem unitSystem ) => throw new NotImplementedException(); - - public bool Equals(IQuantity? other, double tolerance, ComparisonType comparisonType) => throw new NotImplementedException(); - - public string ToString(IFormatProvider? provider) => throw new NotImplementedException(); - - public string ToString(string? format, IFormatProvider? formatProvider) => throw new NotImplementedException(); - - public IQuantity ToUnit(Enum unit, UnitConverter unitConverter) => throw new NotImplementedException(); - - public IQuantity ToUnit(Enum unit ) => throw new NotImplementedException(); - - public IQuantity ToUnit(UnitSystem unitSystem ) => throw new NotImplementedException(); - } -} diff --git a/UnitsNet.Tests/QuantityFormatterTests.cs b/UnitsNet.Tests/QuantityFormatterTests.cs index 721ccaa966..d0c6ba02e3 100644 --- a/UnitsNet.Tests/QuantityFormatterTests.cs +++ b/UnitsNet.Tests/QuantityFormatterTests.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; +using UnitsNet.Tests.Helpers; using Xunit; namespace UnitsNet.Tests @@ -95,9 +96,9 @@ public static void StandardNumericFormatStrings_Equals_ValueWithFormatStringAndA var length = Length.FromMeters(123456789.987654321); var expected = string.Format(CultureInfo.CurrentCulture, $"{{0:{format}}} {{1:a}}", length.Value, length); - Assert.Equal(expected, QuantityFormatter.Format(length, format)); + Assert.Equal(expected, QuantityFormatter.Default.Format(length, format)); } - + [Theory] [InlineData("U")] [InlineData("u")] @@ -140,9 +141,9 @@ public static void StandardNumericFormatStrings_Equals_ValueWithFormatStringAndA public static void Format_WithUnsupportedFormatString_ThrowsFormatException(string format) { var length = Length.FromMeters(123456789.987654321); - Assert.Throws(() => QuantityFormatter.Format(length, format)); + Assert.Throws(() => QuantityFormatter.Default.Format(length, format)); } - + [Fact] public static void StandardNumericFormatStringsAsPartOfLongerFormatStringsWork() { @@ -173,7 +174,27 @@ public static void CustomNumericFormatStrings_Equals_ValueWithFormatStringAndAbb var length = Length.FromMeters(123456789.987654321); var expected = string.Format(CultureInfo.CurrentCulture, $"{{0:{format}}} {{1:a}}", length.Value, length); - Assert.Equal(expected, QuantityFormatter.Format(length, format)); + Assert.Equal(expected, QuantityFormatter.Default.Format(length, format)); + } + + [Fact] + public void Format_WithoutFormatParameter_FormatsWithGeneralFormatWithCurrentCulture() + { + using var cultureScope = new CultureScope(CultureInfo.InvariantCulture); + var length = Length.FromMeters(123.321); + var expected = "123.321 m"; + var actual = QuantityFormatter.Default.Format(length); + Assert.Equal(expected, actual); + } + + [Fact] + public void Format_WithFormatParameter_FormatsWithCurrentCulture() + { + using var cultureScope = new CultureScope(CultureInfo.InvariantCulture); + var length = Length.FromMeters(123.321); + var expected = "123.321 m"; + var actual = QuantityFormatter.Format(length, "G"); + Assert.Equal(expected, actual); } } } diff --git a/UnitsNet.Tests/QuantityTest.cs b/UnitsNet.Tests/QuantityTest.cs index 0f47fd13c4..d683968a39 100644 --- a/UnitsNet.Tests/QuantityTest.cs +++ b/UnitsNet.Tests/QuantityTest.cs @@ -180,7 +180,7 @@ public void TryFrom_GivenValueAndUnit_ReturnsQuantity() [Fact] public void TryParse_GivenInvalidQuantityType_ReturnsFalseAndNullQuantity() { - Assert.False(Quantity.TryParse(InvariantCulture, typeof(DummyIQuantity), "3.0 cm", out IQuantity? parsedLength)); + Assert.False(Quantity.TryParse(InvariantCulture, typeof(DateTime), "3.0 cm", out IQuantity? parsedLength)); Assert.Null(parsedLength); } diff --git a/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs b/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs index aa0bae8fad..fedda4472b 100644 --- a/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs +++ b/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs @@ -126,6 +126,12 @@ public void GetDefaultAbbreviationFallsBackToInvariantCulture() // Assert Assert.Equal("Invariant abbreviation for Unit1", abbreviation); } + + [Fact] + public void GetDefaultAbbreviation_WithNullUnitType_ThrowsArgumentNullException() + { + Assert.Throws(() => UnitAbbreviationsCache.Default.GetDefaultAbbreviation(null!, 1)); + } [Fact] public void GetDefaultAbbreviationThrowsUnitNotFoundExceptionIfNoneExist() @@ -149,6 +155,12 @@ public void GetAllUnitAbbreviationsForQuantity_WithQuantityWithoutAbbreviations_ Assert.Empty(unitAbbreviationsCache.GetAllUnitAbbreviationsForQuantity(typeof(HowMuchUnit))); } + [Fact] + public void GetAllUnitAbbreviationsForQuantity_WithNullUnitType_ThrowsArgumentNullException() + { + Assert.Throws(() => UnitAbbreviationsCache.Default.GetAllUnitAbbreviationsForQuantity(null!)); + } + [Fact] public void GetAllUnitAbbreviationsForQuantity_WithInvalidUnitType_ThrowsArgumentException() { diff --git a/UnitsNet.Tests/UnitKeyTest.cs b/UnitsNet.Tests/UnitKeyTest.cs index 28b78eeb47..469bed03b8 100644 --- a/UnitsNet.Tests/UnitKeyTest.cs +++ b/UnitsNet.Tests/UnitKeyTest.cs @@ -23,16 +23,16 @@ public enum TestUnit public void Constructor_ShouldCreateUnitKey(int unitValue) { var unitKey = new UnitKey(typeof(TestUnit), unitValue); - Assert.Equal(typeof(TestUnit), unitKey.UnitType); - Assert.Equal(unitValue, unitKey.UnitValue); + Assert.Equal(typeof(TestUnit), unitKey.UnitEnumType); + Assert.Equal(unitValue, unitKey.UnitEnumValue); } [Fact] public void Constructor_WithNullType_ShouldNotThrow() { var unitKey = new UnitKey(null!, 0); - Assert.Null(unitKey.UnitType); - Assert.Equal(0, unitKey.UnitValue); + Assert.Null(unitKey.UnitEnumType); + Assert.Equal(0, unitKey.UnitEnumValue); } [Theory] @@ -42,8 +42,8 @@ public void Constructor_WithNullType_ShouldNotThrow() public void ForUnit_ShouldCreateUnitKey(TestUnit unit) { var unitKey = UnitKey.ForUnit(unit); - Assert.Equal(typeof(TestUnit), unitKey.UnitType); - Assert.Equal((int)unit, unitKey.UnitValue); + Assert.Equal(typeof(TestUnit), unitKey.UnitEnumType); + Assert.Equal((int)unit, unitKey.UnitEnumValue); } [Theory] @@ -53,8 +53,31 @@ public void ForUnit_ShouldCreateUnitKey(TestUnit unit) public void Create_ShouldCreateUnitKey(int unitValue) { var unitKey = UnitKey.Create(unitValue); - Assert.Equal(typeof(TestUnit), unitKey.UnitType); - Assert.Equal(unitValue, unitKey.UnitValue); + Assert.Equal(typeof(TestUnit), unitKey.UnitEnumType); + Assert.Equal(unitValue, unitKey.UnitEnumValue); + } + + [Theory] + [InlineData(typeof(TestUnit), 1)] + [InlineData(typeof(TestUnit), 2)] + [InlineData(typeof(TestUnit), 3)] + public void Create_WithUnitTypeAndUnitValue_ShouldCreateUnitKey(Type unitType, int unitValue) + { + var unitKey = UnitKey.Create(unitType, unitValue); + Assert.Equal(unitType, unitKey.UnitEnumType); + Assert.Equal(unitValue, unitKey.UnitEnumValue); + } + + [Fact] + public void Create_WithNullUnitType_ShouldThrowArgumentNullException() + { + Assert.Throws(() => UnitKey.Create(null!, 0)); + } + + [Fact] + public void Create_WithNonEnumType_ShouldThrowArgumentException() + { + Assert.Throws(() => UnitKey.Create(typeof(int), 1)); } [Theory] @@ -64,8 +87,8 @@ public void Create_ShouldCreateUnitKey(int unitValue) public void ImplicitConversion_ShouldCreateUnitKey(TestUnit unit) { UnitKey unitKey = unit; - Assert.Equal(typeof(TestUnit), unitKey.UnitType); - Assert.Equal((int)unit, unitKey.UnitValue); + Assert.Equal(typeof(TestUnit), unitKey.UnitEnumType); + Assert.Equal((int)unit, unitKey.UnitEnumValue); } [Theory] @@ -94,8 +117,8 @@ public void ToUnit_ShouldReturnEnum(TestUnit unit) public void Default_InitializesWithoutAType() { var defaultUnitKey = default(UnitKey); - Assert.Null(defaultUnitKey.UnitType); - Assert.Equal(0, defaultUnitKey.UnitValue); + Assert.Null(defaultUnitKey.UnitEnumType); + Assert.Equal(0, defaultUnitKey.UnitEnumValue); } [Fact] @@ -139,7 +162,7 @@ public void Deconstruct_ShouldReturnTheUnitTypeAndUnitValue() [InlineData(TestUnit.Unit1, "TestUnit.Unit1")] [InlineData(TestUnit.Unit2, "TestUnit.Unit2")] [InlineData(TestUnit.Unit3, "TestUnit.Unit3")] - [InlineData((TestUnit)(-1), "UnitType: UnitsNet.Tests.UnitKeyTest+TestUnit, UnitValue = -1")] + [InlineData((TestUnit)(-1), "UnitEnumType: UnitsNet.Tests.UnitKeyTest+TestUnit, UnitEnumValue = -1")] public void GetDebuggerDisplay_ShouldReturnCorrectString(TestUnit unit, string expectedDisplay) { var unitKey = UnitKey.ForUnit(unit); @@ -154,6 +177,6 @@ public void GetDebuggerDisplayWithDefault_ShouldReturnCorrectString() var defaultUnitKey = default(UnitKey); var display = defaultUnitKey.GetType().GetMethod("GetDebuggerDisplay", BindingFlags.NonPublic | BindingFlags.Instance)! .Invoke(defaultUnitKey, null); - Assert.Equal("UnitType: , UnitValue = 0", display); + Assert.Equal("UnitEnumType: , UnitEnumValue = 0", display); } } diff --git a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs index 9f083fd6ef..05c5f21fce 100644 --- a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs +++ b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs @@ -116,7 +116,7 @@ public void MapUnitToAbbreviation(TUnitType unit, params IEnumerable< /// Unit abbreviations to add. public void MapUnitToAbbreviation(Type unitType, int unitValue, IFormatProvider? formatProvider, params IEnumerable abbreviations) { - MapUnitToAbbreviation(new UnitKey(unitType, unitValue), formatProvider, abbreviations); + MapUnitToAbbreviation(UnitKey.Create(unitType, unitValue), formatProvider, abbreviations); } /// > @@ -159,6 +159,10 @@ public void MapUnitToAbbreviation(UnitKey unitKey, IFormatProvider? formatProvid /// The unit enum value. /// Unit abbreviations to add as default. /// The type of unit enum. + /// + /// Thrown when no unit information is found for the specified + /// . + /// public void MapUnitToDefaultAbbreviation(TUnitType unit, string abbreviation) where TUnitType : struct, Enum { @@ -189,9 +193,15 @@ public void MapUnitToDefaultAbbreviation(TUnitType unit, IFormatProvi /// The unit enum value. /// The format provider to use for lookup. Defaults to if null. /// Unit abbreviation to add as default. + /// + /// Thrown when the provided type is null. + /// + /// + /// Thrown when the provided type is not an enumeration type. + /// public void MapUnitToDefaultAbbreviation(Type unitType, int unitValue, IFormatProvider? formatProvider, string abbreviation) { - MapUnitToDefaultAbbreviation(new UnitKey(unitType, unitValue), formatProvider, abbreviation); + MapUnitToDefaultAbbreviation(UnitKey.Create(unitType, unitValue), formatProvider, abbreviation); } /// > @@ -240,6 +250,12 @@ public string GetDefaultAbbreviation(TUnitType unit, IFormatProvider? /// The unit enum type. /// The unit enum value. /// The format provider to use for lookup. Defaults to if null. + /// + /// Thrown when the provided type is null. + /// + /// + /// Thrown when the provided type is not an enumeration type. + /// /// /// Thrown when no unit information is found for the specified /// and . @@ -249,7 +265,7 @@ public string GetDefaultAbbreviation(TUnitType unit, IFormatProvider? /// public string GetDefaultAbbreviation(Type unitType, int unitValue, IFormatProvider? formatProvider = null) { - return GetDefaultAbbreviation(new UnitKey(unitType, unitValue), formatProvider); + return GetDefaultAbbreviation(UnitKey.Create(unitType, unitValue), formatProvider); } /// @@ -267,7 +283,7 @@ public string GetDefaultAbbreviation(UnitKey unitKey, IFormatProvider? formatPro IReadOnlyList abbreviations = GetUnitAbbreviations(unitKey, formatProvider); if (abbreviations.Count == 0) { - throw new InvalidOperationException($"No abbreviations were found for {unitKey.UnitType.Name}.{(Enum)unitKey}. Make sure that the unit abbreviations are mapped."); + throw new InvalidOperationException($"No abbreviations were found for {unitKey.UnitEnumType.Name}.{(Enum)unitKey}. Make sure that the unit abbreviations are mapped."); } return abbreviations[0]; @@ -297,13 +313,19 @@ public IReadOnlyList GetUnitAbbreviations(TUnitType unit, IFo /// Enum value for unit. /// The format provider to use for lookup. Defaults to if null. /// Unit abbreviations associated with unit. + /// + /// Thrown when the provided type is null. + /// + /// + /// Thrown when the provided type is not an enumeration type. + /// /// /// Thrown when no unit information is found for the specified /// and . /// public IReadOnlyList GetUnitAbbreviations(Type unitType, int unitValue, IFormatProvider? formatProvider = null) { - return GetUnitAbbreviations(new UnitKey(unitType, unitValue), formatProvider); + return GetUnitAbbreviations(UnitKey.Create(unitType, unitValue), formatProvider); } /// @@ -336,19 +358,27 @@ public IReadOnlyList GetUnitAbbreviations(UnitKey unitKey, IFormatProvid /// /// A read-only list of unit abbreviations associated with the specified unit type. /// + /// + /// Thrown when the provided type is null. + /// /// - /// Thrown when the provided is not an enum type. + /// Thrown when the provided type is not an enumeration type. /// /// /// Thrown when no quantity is found for the specified unit type. /// public IReadOnlyList GetAllUnitAbbreviationsForQuantity(Type unitEnumType, IFormatProvider? formatProvider = null) { + if (unitEnumType == null) + { + throw new ArgumentNullException(nameof(unitEnumType)); + } + if (!Quantities.TryGetQuantityByUnitType(unitEnumType, out QuantityInfo? quantityInfo)) { if (!unitEnumType.IsEnum) { - throw new ArgumentException($"Type {unitEnumType.FullName} is not a supported unit type."); + throw new ArgumentException($"Unit type must be an enumeration, but was {unitEnumType.FullName}.", nameof(unitEnumType)); } throw new UnitNotFoundException($"No quantity was found with the specified unit type: '{unitEnumType}'.") { Data = { ["unitType"] = unitEnumType.Name } }; @@ -463,7 +493,7 @@ private static List ReadAbbreviationsFromResourceFile(UnitInfo unitInfo, { var abbreviationsList = new List(); // we currently don't have any way of providing external resource dictionaries - Assembly unitAssembly = unitInfo.UnitKey.UnitType.Assembly; + Assembly unitAssembly = unitInfo.UnitKey.UnitEnumType.Assembly; if (unitAssembly != typeof(UnitAbbreviationsCache).Assembly) { return abbreviationsList; diff --git a/UnitsNet/CustomCode/UnitKey.cs b/UnitsNet/CustomCode/UnitKey.cs index f759dac2a0..64079dcf24 100644 --- a/UnitsNet/CustomCode/UnitKey.cs +++ b/UnitsNet/CustomCode/UnitKey.cs @@ -17,8 +17,8 @@ namespace UnitsNet; public readonly record struct UnitKey { // apparently, on netstandard, the use of auto-properties is significantly slower - private readonly Type _unitType; - private readonly int _unitValue; + private readonly Type _unitEnumType; + private readonly int _unitEnumValue; /// /// Represents a unique key for a unit type and its corresponding value. @@ -27,10 +27,10 @@ public readonly record struct UnitKey /// This key is particularly useful when using an enum-based unit in a hash-based collection, /// as it avoids the boxing that would normally occur when casting the enum to . /// - public UnitKey(Type UnitType, int UnitValue) + internal UnitKey(Type UnitEnumType, int UnitEnumValue) { - _unitType = UnitType; - _unitValue = UnitValue; + _unitEnumType = UnitEnumType; + _unitEnumValue = UnitEnumValue; } /// @@ -40,9 +40,9 @@ public UnitKey(Type UnitType, int UnitValue) /// This property holds the of the unit enumeration associated with this key. /// It is particularly useful for identifying the unit type in scenarios where multiple unit types are used. /// - public Type UnitType + public Type UnitEnumType { - get => _unitType; + get => _unitEnumType; } /// @@ -52,9 +52,9 @@ public Type UnitType /// This property represents the unique value of the unit within its type, typically corresponding to the underlying /// integer value of an enumeration. /// - public int UnitValue + public int UnitEnumValue { - get => _unitValue; + get => _unitEnumValue; } /// @@ -81,6 +81,36 @@ public static UnitKey Create(int unitValue) return new UnitKey(typeof(TUnit), unitValue); } + /// + /// Creates a new instance of the struct for the specified unit type and value. + /// + /// The type of the unit, which must be an enumeration. + /// The integer value representing the unit. + /// A new instance of the struct. + /// + /// Thrown if is null. + /// + /// + /// Thrown if is not an enumeration type. + /// + /// + /// This method is useful for creating a when the unit type and value are known. + /// + public static UnitKey Create(Type unitType, int unitValue) + { + if (unitType is null) + { + throw new ArgumentNullException(nameof(unitType)); + } + + if (!unitType.IsEnum) + { + throw new ArgumentException($"Unit type must be an enumeration, but was {unitType.FullName}.", nameof(unitType)); + } + + return new UnitKey(unitType, unitValue); + } + /// /// Implicitly converts an enumeration value to a . /// @@ -111,7 +141,7 @@ public static implicit operator UnitKey(Enum unit) /// public static explicit operator Enum(UnitKey unitKey) { - return (Enum)Enum.ToObject(unitKey._unitType, unitKey._unitValue); + return (Enum)Enum.ToObject(unitKey._unitEnumType, unitKey._unitEnumValue); } /// @@ -129,12 +159,12 @@ public static explicit operator Enum(UnitKey unitKey) /// public TUnit ToUnit() where TUnit : struct, Enum { - if (typeof(TUnit) != _unitType) + if (typeof(TUnit) != _unitEnumType) { - throw new InvalidOperationException($"Cannot convert UnitKey of type {_unitType} to {typeof(TUnit)}."); + throw new InvalidOperationException($"Cannot convert UnitKey of type {_unitEnumType} to {typeof(TUnit)}."); } - var unitValue = _unitValue; + var unitValue = _unitEnumValue; return Unsafe.As(ref unitValue); } @@ -142,12 +172,12 @@ private string GetDebuggerDisplay() { try { - var unitName = Enum.GetName(_unitType, _unitValue); - return string.IsNullOrEmpty(unitName) ? $"{nameof(UnitType)}: {_unitType}, {nameof(UnitValue)} = {_unitValue}" : $"{_unitType.Name}.{unitName}"; + var unitName = Enum.GetName(_unitEnumType, _unitEnumValue); + return string.IsNullOrEmpty(unitName) ? $"{nameof(UnitEnumType)}: {_unitEnumType}, {nameof(UnitEnumValue)} = {_unitEnumValue}" : $"{_unitEnumType.Name}.{unitName}"; } catch { - return $"{nameof(UnitType)}: {_unitType}, {nameof(UnitValue)} = {_unitValue}"; + return $"{nameof(UnitEnumType)}: {_unitEnumType}, {nameof(UnitEnumValue)} = {_unitEnumValue}"; } } @@ -162,8 +192,8 @@ private string GetDebuggerDisplay() /// public void Deconstruct(out Type unitType, out int unitValue) { - unitType = _unitType; - unitValue = _unitValue; + unitType = _unitEnumType; + unitValue = _unitEnumValue; } #region Equality members @@ -172,21 +202,21 @@ public void Deconstruct(out Type unitType, out int unitValue) public bool Equals(UnitKey other) { // implementing the Equality members on net48 is 5x faster than the default - return _unitType == other._unitType && _unitValue == other._unitValue; + return _unitEnumType == other._unitEnumType && _unitEnumValue == other._unitEnumValue; } /// public override int GetHashCode() { // implementing the Equality members on net48 is 5x faster than the default - if (_unitType == null) + if (_unitEnumType == null) { - return _unitValue; + return _unitEnumValue; } unchecked { - return (_unitType.GetHashCode() * 397) ^ _unitValue; + return (_unitEnumType.GetHashCode() * 397) ^ _unitEnumValue; } } diff --git a/UnitsNet/CustomCode/UnitsNetSetup.cs b/UnitsNet/CustomCode/UnitsNetSetup.cs index 76ac4c7d26..6533fa4244 100644 --- a/UnitsNet/CustomCode/UnitsNetSetup.cs +++ b/UnitsNet/CustomCode/UnitsNetSetup.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; using System.Collections.Generic; using System.Linq; using UnitsNet.Units; @@ -14,7 +15,7 @@ namespace UnitsNet; /// abbreviations.
/// Alternatively, a setup instance may be provided for most static methods, such as /// and -/// . +/// . ///
public sealed class UnitsNetSetup { @@ -35,9 +36,10 @@ public UnitsNetSetup(IEnumerable quantityInfos, UnitConverter unit { var quantityInfoLookup = new QuantityInfoLookup(quantityInfos); var unitAbbreviations = new UnitAbbreviationsCache(quantityInfoLookup); - + UnitConverter = unitConverter; UnitAbbreviations = unitAbbreviations; + Formatter = new QuantityFormatter(unitAbbreviations); UnitParser = new UnitParser(unitAbbreviations); QuantityParser = new QuantityParser(unitAbbreviations); QuantityInfoLookup = quantityInfoLookup; @@ -65,6 +67,11 @@ public UnitsNetSetup(IEnumerable quantityInfos, UnitConverter unit /// quantities. ///
public UnitAbbreviationsCache UnitAbbreviations { get; } + + /// + /// Converts a quantity to string using the specified format strings and culture-specific format providers. + /// + public QuantityFormatter Formatter { get; } /// /// Parses units from strings, such as from "cm". diff --git a/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs b/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs index 61c69b1914..57cfee1b8d 100644 --- a/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs @@ -165,25 +165,30 @@ public AbsorbedDoseOfIonizingRadiation(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public AbsorbedDoseOfIonizingRadiationUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => AbsorbedDoseOfIonizingRadiation.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1040,7 +1045,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1051,16 +1056,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs index d4c9b3fc07..584ac0de3e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs @@ -167,25 +167,30 @@ public Acceleration(double value, UnitSystem unitSystem) ///
public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public AccelerationUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Acceleration.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1042,7 +1047,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1053,16 +1058,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs index a16a1ed244..e381b30dd4 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -171,25 +171,30 @@ public AmountOfSubstance(double value, UnitSystem unitSystem) ///
public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public AmountOfSubstanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => AmountOfSubstance.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1103,7 +1108,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1114,16 +1119,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs index 098d167406..bc258c9816 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs @@ -136,25 +136,30 @@ public AmplitudeRatio(double value, AmplitudeRatioUnit unit) ///
public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public AmplitudeRatioUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => AmplitudeRatio.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -815,7 +820,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -826,16 +831,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs index 6e8431fdfb..7ceef7ca45 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs @@ -152,25 +152,30 @@ public Angle(double value, AngleUnit unit) ///
public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public AngleUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Angle.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1032,7 +1037,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1043,16 +1048,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs index a8cd075955..0b0b9cfcfd 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs @@ -178,25 +178,30 @@ public Area(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public AreaUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Area.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1126,7 +1131,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1137,16 +1142,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs index 619cf482a9..6c495102d4 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs @@ -152,25 +152,30 @@ public AreaDensity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public AreaDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => AreaDensity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -816,7 +821,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -827,16 +832,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs index 9de4dcc557..9bf65b7675 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -156,25 +156,30 @@ public AreaMomentOfInertia(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public AreaMomentOfInertiaUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => AreaMomentOfInertia.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -877,7 +882,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -888,16 +893,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs index a08e95a9c5..62ce547c49 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs @@ -188,25 +188,30 @@ public BitRate(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public BitRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => BitRate.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1454,7 +1459,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1465,16 +1470,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs index d6844e3876..87b0f7dcf6 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -153,25 +153,30 @@ public BrakeSpecificFuelConsumption(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public BrakeSpecificFuelConsumptionUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => BrakeSpecificFuelConsumption.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -829,7 +834,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -840,16 +845,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs index 99b39b03a2..01ab892215 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs @@ -155,25 +155,30 @@ public CoefficientOfThermalExpansion(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public CoefficientOfThermalExpansionUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => CoefficientOfThermalExpansion.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -870,7 +875,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -881,16 +886,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs index 89a2af7e50..1286088069 100644 --- a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs @@ -153,25 +153,30 @@ public Compressibility(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public CompressibilityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Compressibility.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -875,7 +880,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -886,16 +891,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs index 830c22ba88..9c5f68a4b6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -214,25 +214,30 @@ public Density(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public DensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Density.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1822,7 +1827,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1833,16 +1838,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs b/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs index b6906e684b..0258546dca 100644 --- a/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs @@ -169,25 +169,30 @@ public DoseAreaProduct(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public DoseAreaProductUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => DoseAreaProduct.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1112,7 +1117,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1123,16 +1128,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs index a479205aef..29a6b52b27 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs @@ -175,25 +175,30 @@ public Duration(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public DurationUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Duration.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1076,7 +1081,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1087,16 +1092,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs index faa7da9fcb..7c99e89231 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -163,25 +163,30 @@ public DynamicViscosity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public DynamicViscosityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => DynamicViscosity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -952,7 +957,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -963,16 +968,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs index edf5ad970c..9fccdb2ac0 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs @@ -166,25 +166,30 @@ public ElectricAdmittance(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricAdmittanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricAdmittance.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1041,7 +1046,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1052,16 +1057,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs index cf642f0af3..c3c0cb98eb 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs @@ -149,25 +149,30 @@ public ElectricApparentEnergy(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricApparentEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricApparentEnergy.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -803,7 +808,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -814,16 +819,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs index 7ede397da4..7582b2cee5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs @@ -155,25 +155,30 @@ public ElectricApparentPower(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricApparentPowerUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricApparentPower.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -860,7 +865,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -871,16 +876,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs index c55d35b0dd..5b9e0a6516 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs @@ -156,25 +156,30 @@ public ElectricCapacitance(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricCapacitanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricCapacitance.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -878,7 +883,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -889,16 +894,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs index 0321cd3cfc..6d0fe93098 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -165,25 +165,30 @@ public ElectricCharge(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricChargeUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricCharge.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -977,7 +982,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -988,16 +993,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs index ee7a588226..8dc4b7eb73 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs @@ -150,25 +150,30 @@ public ElectricChargeDensity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricChargeDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricChargeDensity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -770,7 +775,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -781,16 +786,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs index b4c96c9072..31ae1f7508 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs @@ -165,25 +165,30 @@ public ElectricConductance(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricConductanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricConductance.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1040,7 +1045,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1051,16 +1056,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs index 8387380c21..6185357f60 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -155,25 +155,30 @@ public ElectricConductivity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricConductivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricConductivity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -871,7 +876,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -882,16 +887,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs index 4d446d8a21..1f401e6938 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -165,25 +165,30 @@ public ElectricCurrent(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricCurrentUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricCurrent.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -955,7 +960,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -966,16 +971,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs index f902a69659..6e60b45b35 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs @@ -152,25 +152,30 @@ public ElectricCurrentDensity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricCurrentDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricCurrentDensity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -806,7 +811,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -817,16 +822,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs index 308a0746ab..d6f5d8e9b2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -156,25 +156,30 @@ public ElectricCurrentGradient(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricCurrentGradientUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricCurrentGradient.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -888,7 +893,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -899,16 +904,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs index 39a606aec0..c18116b8d2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs @@ -150,25 +150,30 @@ public ElectricField(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricFieldUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricField.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -770,7 +775,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -781,16 +786,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs index b14c0c5f15..3bc020f499 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs @@ -158,25 +158,30 @@ public ElectricImpedance(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricImpedanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricImpedance.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -897,7 +902,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -908,16 +913,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs index 2f1d101169..73e87af91e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs @@ -154,25 +154,30 @@ public ElectricInductance(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricInductanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricInductance.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -842,7 +847,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -853,16 +858,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs index 41fd1e4fa2..0524f7ba67 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -161,25 +161,30 @@ public ElectricPotential(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricPotentialUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricPotential.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -894,7 +899,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -905,16 +910,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs index 90e8348ca8..1a7d89b1ca 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs @@ -166,25 +166,30 @@ public ElectricPotentialChangeRate(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricPotentialChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricPotentialChangeRate.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1109,7 +1114,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1120,16 +1125,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs index 2fbe11e9c8..d38bbf9f28 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs @@ -157,25 +157,30 @@ public ElectricReactance(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricReactanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricReactance.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -896,7 +901,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -907,16 +912,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs index bc9a9c99b1..fcbda67d80 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs @@ -149,25 +149,30 @@ public ElectricReactiveEnergy(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricReactiveEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricReactiveEnergy.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -803,7 +808,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -814,16 +819,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs index 5957f1b3ce..7e3602d3af 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs @@ -153,25 +153,30 @@ public ElectricReactivePower(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricReactivePowerUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricReactivePower.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -824,7 +829,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -835,16 +840,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs index f3010957d8..f4680cbd50 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -160,25 +160,30 @@ public ElectricResistance(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricResistanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricResistance.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -909,7 +914,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -920,16 +925,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs index 1958835e8e..549bc37d8d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -163,25 +163,30 @@ public ElectricResistivity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricResistivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricResistivity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1015,7 +1020,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1026,16 +1031,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs index bbb780b14f..6e48ad9179 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs @@ -152,25 +152,30 @@ public ElectricSurfaceChargeDensity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricSurfaceChargeDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricSurfaceChargeDensity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -806,7 +811,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -817,16 +822,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs index 7b3089f890..9de5b7aa28 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs @@ -165,25 +165,30 @@ public ElectricSusceptance(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ElectricSusceptanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ElectricSusceptance.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1040,7 +1045,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1051,16 +1056,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs index 3cf307f906..b1023afba3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs @@ -201,25 +201,30 @@ public Energy(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public EnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Energy.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1566,7 +1571,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1577,16 +1582,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs index a45fc2b844..e8cc4d1578 100644 --- a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs @@ -161,25 +161,30 @@ public EnergyDensity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public EnergyDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => EnergyDensity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -978,7 +983,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -989,16 +994,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs index f6b1ece0d4..96b8253b31 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs @@ -158,25 +158,30 @@ public Entropy(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public EntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Entropy.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -902,7 +907,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -913,16 +918,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs index 250c70554c..c2051578d5 100644 --- a/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs @@ -168,25 +168,30 @@ public FluidResistance(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public FluidResistanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => FluidResistance.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1094,7 +1099,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1105,16 +1110,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Force.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.g.cs index 744b886a40..0cf91ae539 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs @@ -175,25 +175,30 @@ public Force(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ForceUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Force.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1109,7 +1114,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1120,16 +1125,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs index fe20ac80fa..4d11b9388e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -164,25 +164,30 @@ public ForceChangeRate(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ForceChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ForceChangeRate.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1032,7 +1037,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1043,16 +1048,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs index 9551e0a1a7..4111623605 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -195,25 +195,30 @@ public ForcePerLength(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ForcePerLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ForcePerLength.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1502,7 +1507,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1513,16 +1518,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs index 1888ad0f61..34e9ca573d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs @@ -161,25 +161,30 @@ public Frequency(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public FrequencyUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Frequency.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -978,7 +983,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -989,16 +994,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs index 45ae359cdb..8df73ecc28 100644 --- a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs @@ -153,25 +153,30 @@ public FuelEfficiency(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public FuelEfficiencyUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => FuelEfficiency.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -824,7 +829,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -835,16 +840,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs index 673608e9c5..8006caf670 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs @@ -167,25 +167,30 @@ public HeatFlux(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public HeatFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => HeatFlux.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1086,7 +1091,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1097,16 +1102,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs index 98f86d1203..7489c8f9ac 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs @@ -151,25 +151,30 @@ public HeatTransferCoefficient(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public HeatTransferCoefficientUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => HeatTransferCoefficient.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -839,7 +844,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -850,16 +855,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs index 99a0d03821..1919e9a0cb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs @@ -156,25 +156,30 @@ public Illuminance(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public IlluminanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Illuminance.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -837,7 +842,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -848,16 +853,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs b/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs index f5fa7da371..cadf0717ce 100644 --- a/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs @@ -159,25 +159,30 @@ public Impulse(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ImpulseUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Impulse.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -983,7 +988,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -994,16 +999,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Information.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.g.cs index 79313dec40..cca7dcbb53 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.g.cs @@ -171,25 +171,30 @@ public Information(double value, InformationUnit unit) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public InformationUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Information.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1437,7 +1442,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1448,16 +1453,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs index 9b599143c4..7a9010e546 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs @@ -160,25 +160,30 @@ public Irradiance(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public IrradianceUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Irradiance.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1001,7 +1006,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1012,16 +1017,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs index 6eaa03e2ad..5830988e67 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs @@ -158,25 +158,30 @@ public Irradiation(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public IrradiationUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Irradiation.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -914,7 +919,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -925,16 +930,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs index 41237bc569..0487a05d5f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs @@ -160,25 +160,30 @@ public Jerk(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public JerkUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Jerk.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -960,7 +965,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -971,16 +976,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs index 1534736108..15f8bec30c 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -164,25 +164,30 @@ public KinematicViscosity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public KinematicViscosityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => KinematicViscosity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -948,7 +953,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -959,16 +964,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs b/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs index cf25705f70..031d8571e5 100644 --- a/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs @@ -152,25 +152,30 @@ public LeakRate(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public LeakRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => LeakRate.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -806,7 +811,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -817,16 +822,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs index 37ac283f0b..c60350df15 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by \generate-code.bat. // @@ -208,25 +208,30 @@ public Length(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public LengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Length.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1644,7 +1649,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1655,16 +1660,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Level.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.g.cs index 3e99a5b691..8b13dab6d0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.g.cs @@ -134,25 +134,30 @@ public Level(double value, LevelUnit unit) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public LevelUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Level.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -779,7 +784,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -790,16 +795,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs index 28fb536ff7..42be914595 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs @@ -172,25 +172,30 @@ public LinearDensity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public LinearDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => LinearDensity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1103,7 +1108,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1114,16 +1119,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs index 694458b47f..9f58cb012f 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs @@ -174,25 +174,30 @@ public LinearPowerDensity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public LinearPowerDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => LinearPowerDensity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1202,7 +1207,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1213,16 +1218,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs index 8ef359173e..763826f11b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs @@ -162,25 +162,30 @@ public Luminance(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public LuminanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Luminance.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -945,7 +950,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -956,16 +961,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs index 46f18c0d8b..6eaaaf560c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs @@ -163,25 +163,30 @@ public Luminosity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public LuminosityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Luminosity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1004,7 +1009,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1015,16 +1020,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs index e531b04dac..51a7aedab5 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs @@ -154,25 +154,30 @@ public LuminousFlux(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public LuminousFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => LuminousFlux.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -790,7 +795,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -801,16 +806,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs index cf8f995c8f..cf10a6929e 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -154,25 +154,30 @@ public LuminousIntensity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public LuminousIntensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => LuminousIntensity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -790,7 +795,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -801,16 +806,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs index 48a0aef6d1..ea33a6055c 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs @@ -155,25 +155,30 @@ public MagneticField(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public MagneticFieldUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => MagneticField.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -860,7 +865,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -871,16 +876,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs index a14bf1db5a..d7b0b286f4 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs @@ -150,25 +150,30 @@ public MagneticFlux(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public MagneticFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => MagneticFlux.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -770,7 +775,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -781,16 +786,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs index b76db86cba..57f3d001c6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs @@ -150,25 +150,30 @@ public Magnetization(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public MagnetizationUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Magnetization.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -770,7 +775,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -781,16 +786,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs index 28f966753f..9ecb3ea89d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs @@ -191,25 +191,30 @@ public Mass(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public MassUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Mass.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1353,7 +1358,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1364,16 +1369,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs index 1fbfadd87a..057487a995 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs @@ -205,25 +205,30 @@ public MassConcentration(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public MassConcentrationUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => MassConcentration.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1675,7 +1680,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1686,16 +1691,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs index 504dfabb95..5ef954faca 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs @@ -191,25 +191,30 @@ public MassFlow(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public MassFlowUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => MassFlow.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1419,7 +1424,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1430,16 +1435,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs index a0fe7a9083..2585ae1f64 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs @@ -163,25 +163,30 @@ public MassFlux(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public MassFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => MassFlux.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -992,7 +997,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1003,16 +1008,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs index b04fb6b2da..7049f5d0c7 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs @@ -162,25 +162,30 @@ public MassFraction(double value, MassFractionUnit unit) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public MassFractionUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => MassFraction.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1183,7 +1188,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1194,16 +1199,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs index 0619644d5a..acd8dd86ba 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs @@ -174,25 +174,30 @@ public MassMomentOfInertia(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public MassMomentOfInertiaUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => MassMomentOfInertia.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1253,7 +1258,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1264,16 +1269,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Molality.g.cs b/UnitsNet/GeneratedCode/Quantities/Molality.g.cs index 2ce5816efe..15ac985bf3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molality.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molality.g.cs @@ -152,25 +152,30 @@ public Molality(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public MolalityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Molality.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -806,7 +811,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -817,16 +822,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs index 627a25bde1..ce6967aa3b 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs @@ -152,25 +152,30 @@ public MolarEnergy(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public MolarEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => MolarEnergy.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -816,7 +821,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -827,16 +832,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs index 05ff66d5ca..1da342ca2b 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs @@ -149,25 +149,30 @@ public MolarEntropy(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public MolarEntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => MolarEntropy.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -803,7 +808,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -814,16 +819,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs index 8787d4e294..280bfb5126 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs @@ -161,25 +161,30 @@ public MolarFlow(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public MolarFlowUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => MolarFlow.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -945,7 +950,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -956,16 +961,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs index 82ec4e0201..b0dc8647f7 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs @@ -164,25 +164,30 @@ public MolarMass(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public MolarMassUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => MolarMass.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1010,7 +1015,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1021,16 +1026,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs index c3b2546a84..6cc86296ef 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs @@ -167,25 +167,30 @@ public Molarity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public MolarityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Molarity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -991,7 +996,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1002,16 +1007,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs index 397897e252..9a72750e46 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs @@ -150,25 +150,30 @@ public Permeability(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public PermeabilityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Permeability.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -770,7 +775,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -781,16 +786,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs index 6a6744239f..8d8262bd1c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs @@ -150,25 +150,30 @@ public Permittivity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public PermittivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Permittivity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -770,7 +775,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -781,16 +786,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs b/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs index 4969efb4be..ed12c3eaa5 100644 --- a/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs @@ -154,25 +154,30 @@ public PorousMediumPermeability(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public PorousMediumPermeabilityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => PorousMediumPermeability.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -842,7 +847,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -853,16 +858,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Power.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.g.cs index 0dcade6bdc..7246b0241d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.g.cs @@ -189,25 +189,30 @@ public Power(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public PowerUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Power.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1339,7 +1344,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1350,16 +1355,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs index 9844764592..92e952fd10 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs @@ -190,25 +190,30 @@ public PowerDensity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public PowerDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => PowerDensity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1541,7 +1546,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1552,16 +1557,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs index 3a02ffda79..71a896abfa 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs @@ -134,25 +134,30 @@ public PowerRatio(double value, PowerRatioUnit unit) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public PowerRatioUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => PowerRatio.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -779,7 +784,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -790,16 +795,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs index 6e7a83f36b..12bdbf77df 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs @@ -205,25 +205,30 @@ public Pressure(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public PressureUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Pressure.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1671,7 +1676,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1682,16 +1687,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs index 7097036780..38533f3058 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -167,25 +167,30 @@ public PressureChangeRate(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public PressureChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => PressureChangeRate.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1086,7 +1091,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1097,16 +1102,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDose.g.cs b/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDose.g.cs index 5d9c6d684e..b57f0adb9e 100644 --- a/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDose.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDose.g.cs @@ -156,25 +156,30 @@ public RadiationEquivalentDose(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public RadiationEquivalentDoseUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => RadiationEquivalentDose.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -877,7 +882,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -888,16 +893,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDoseRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDoseRate.g.cs index c455db3f1c..5899e3d517 100644 --- a/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDoseRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RadiationEquivalentDoseRate.g.cs @@ -159,25 +159,30 @@ public RadiationEquivalentDoseRate(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public RadiationEquivalentDoseRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => RadiationEquivalentDoseRate.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -942,7 +947,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -953,16 +958,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs b/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs index 1c0679e182..01761c4a4b 100644 --- a/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RadiationExposure.g.cs @@ -154,25 +154,30 @@ public RadiationExposure(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public RadiationExposureUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => RadiationExposure.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -893,7 +898,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -904,16 +909,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs index c37ece973b..14f51a39b3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Radioactivity.g.cs @@ -175,25 +175,30 @@ public Radioactivity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public RadioactivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Radioactivity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1271,7 +1276,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1282,16 +1287,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs index f663d65898..71dfdab69d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs @@ -138,25 +138,30 @@ public Ratio(double value, RatioUnit unit) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public RatioUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Ratio.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -843,7 +848,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -854,16 +859,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs index b00a3a244a..5c9c658d66 100644 --- a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs @@ -148,25 +148,30 @@ public RatioChangeRate(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public RatioChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => RatioChangeRate.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -785,7 +790,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -796,16 +801,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs index 05c19cd7e5..0e8f6a6ca7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs @@ -167,25 +167,30 @@ public ReciprocalArea(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ReciprocalAreaUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ReciprocalArea.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -998,7 +1003,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1009,16 +1014,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs index 77768d0102..e6065e26fb 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs @@ -168,25 +168,30 @@ public ReciprocalLength(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ReciprocalLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ReciprocalLength.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -994,7 +999,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1005,16 +1010,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs index 4491545fdd..45620d538a 100644 --- a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs @@ -133,25 +133,30 @@ public RelativeHumidity(double value, RelativeHumidityUnit unit) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public RelativeHumidityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => RelativeHumidity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -753,7 +758,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -764,16 +769,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs index 6c99853c2d..03fd744cf7 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs @@ -150,25 +150,30 @@ public RotationalAcceleration(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public RotationalAccelerationUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => RotationalAcceleration.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -821,7 +826,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -832,16 +837,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs index ecc9edcf38..353f25359f 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -163,25 +163,30 @@ public RotationalSpeed(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public RotationalSpeedUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => RotationalSpeed.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1003,7 +1008,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1014,16 +1019,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs index 1a4da124a0..a035083f0f 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -184,25 +184,30 @@ public RotationalStiffness(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public RotationalStiffnessUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => RotationalStiffness.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1370,7 +1375,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1381,16 +1386,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs index b8329568c6..1c61d270bf 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -154,25 +154,30 @@ public RotationalStiffnessPerLength(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public RotationalStiffnessPerLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => RotationalStiffnessPerLength.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -852,7 +857,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -863,16 +868,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs index 14f3f0fe39..168d57fd09 100644 --- a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs @@ -133,25 +133,30 @@ public Scalar(double value, ScalarUnit unit) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ScalarUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Scalar.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -753,7 +758,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -764,16 +769,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs index 14cc0f833b..ce4f4cf588 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs @@ -136,25 +136,30 @@ public SolidAngle(double value, SolidAngleUnit unit) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public SolidAngleUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => SolidAngle.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -756,7 +761,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -767,16 +772,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs index bb14154cbf..ca20c24014 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -187,25 +187,30 @@ public SpecificEnergy(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public SpecificEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => SpecificEnergy.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1346,7 +1351,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1357,16 +1362,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs index e8a80429b4..b27dc303be 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -159,25 +159,30 @@ public SpecificEntropy(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public SpecificEntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => SpecificEntropy.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -931,7 +936,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -942,16 +947,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs index 7ebafcc1ec..d824513537 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs @@ -153,25 +153,30 @@ public SpecificFuelConsumption(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public SpecificFuelConsumptionUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => SpecificFuelConsumption.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -824,7 +829,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -835,16 +840,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs index c591df319b..07f1994a8a 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -152,25 +152,30 @@ public SpecificVolume(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public SpecificVolumeUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => SpecificVolume.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -823,7 +828,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -834,16 +839,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs index 1d47a56e5e..d8551976b7 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -172,25 +172,30 @@ public SpecificWeight(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public SpecificWeightUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => SpecificWeight.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1092,7 +1097,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1103,16 +1108,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs index e38b7bc4f3..73885a877c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs @@ -189,25 +189,30 @@ public Speed(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public SpeedUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Speed.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1405,7 +1410,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1416,16 +1421,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs index f6314261a6..eab2b96bb1 100644 --- a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs @@ -155,25 +155,30 @@ public StandardVolumeFlow(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public StandardVolumeFlowUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => StandardVolumeFlow.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -911,7 +916,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -922,16 +927,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs index db62816d43..6fadae50c4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs @@ -153,25 +153,30 @@ public Temperature(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public TemperatureUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Temperature.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -880,7 +885,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -891,16 +896,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs index 91f73eb051..e0a101b12a 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -166,25 +166,30 @@ public TemperatureChangeRate(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public TemperatureChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => TemperatureChangeRate.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1068,7 +1073,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1079,16 +1084,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs index a24c1fd4e2..c72a69624b 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -164,25 +164,30 @@ public TemperatureDelta(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public TemperatureDeltaUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => TemperatureDelta.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -966,7 +971,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -977,16 +982,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs index 369f7becb5..11d64354e1 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs @@ -153,25 +153,30 @@ public TemperatureGradient(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public TemperatureGradientUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => TemperatureGradient.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -834,7 +839,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -845,16 +850,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs index f007bbbc60..e31ec01384 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs @@ -151,25 +151,30 @@ public ThermalConductivity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ThermalConductivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ThermalConductivity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -788,7 +793,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -799,16 +804,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalInsulance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalInsulance.g.cs index 1c32b3e957..0133fcd6fa 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalInsulance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalInsulance.g.cs @@ -152,25 +152,30 @@ public ThermalInsulance(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public ThermalInsulanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => ThermalInsulance.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -857,7 +862,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -868,16 +873,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs index 010bb108ee..7632fb2fdd 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs @@ -180,25 +180,30 @@ public Torque(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public TorqueUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Torque.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1254,7 +1259,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1265,16 +1270,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs index d20a0252a4..ec02d68ebb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs @@ -136,25 +136,30 @@ public Turbidity(double value, TurbidityUnit unit) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public TurbidityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Turbidity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -756,7 +761,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -767,16 +772,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs index f58eb1dd2a..143f790aa5 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs @@ -133,25 +133,30 @@ public VitaminA(double value, VitaminAUnit unit) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public VitaminAUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => VitaminA.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -753,7 +758,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -764,16 +769,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs index 652751d3f9..711534ca4a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -215,25 +215,30 @@ public Volume(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public VolumeUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => Volume.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1818,7 +1823,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1829,16 +1834,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs index a7a5599d6a..5130c4b829 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs @@ -159,25 +159,30 @@ public VolumeConcentration(double value, VolumeConcentrationUnit unit) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public VolumeConcentrationUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => VolumeConcentration.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -1118,7 +1123,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -1129,16 +1134,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs index b2aef7124a..b160969e5f 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -228,25 +228,30 @@ public VolumeFlow(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public VolumeFlowUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => VolumeFlow.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -2140,7 +2145,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -2151,16 +2156,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs index 7e778a65a5..903b1ab63b 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs @@ -148,25 +148,30 @@ public VolumeFlowPerArea(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public VolumeFlowPerAreaUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => VolumeFlowPerArea.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -785,7 +790,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -796,16 +801,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs index 8ae19ff381..49a17c2b03 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -155,25 +155,30 @@ public VolumePerLength(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public VolumePerLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => VolumePerLength.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -911,7 +916,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -922,16 +927,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs index bf2d259b18..e1888a5ac6 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs @@ -158,25 +158,30 @@ public VolumetricHeatCapacity(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public VolumetricHeatCapacityUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => VolumetricHeatCapacity.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -914,7 +919,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -925,16 +930,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs index 61f7be1c0d..6426a72417 100644 --- a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs @@ -152,25 +152,30 @@ public WarpingMomentOfInertia(double value, UnitSystem unitSystem) /// public double Value => _value; - /// - double IQuantity.Value => _value; - - Enum IQuantity.Unit => Unit; - /// public WarpingMomentOfInertiaUnit Unit => _unit.GetValueOrDefault(BaseUnit); /// public QuantityInfo QuantityInfo => Info; - /// - QuantityInfo IQuantity.QuantityInfo => Info; - /// /// The of this quantity. /// public BaseDimensions Dimensions => WarpingMomentOfInertia.BaseDimensions; + #region Explicit implementations + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Enum IQuantity.Unit => Unit; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + UnitKey IQuantity.UnitKey => UnitKey.ForUnit(Unit); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + QuantityInfo IQuantity.QuantityInfo => Info; + + #endregion + #endregion #region Conversion Properties @@ -857,7 +862,7 @@ public string ToString(IFormatProvider? provider) return ToString(null, provider); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using . /// @@ -868,16 +873,13 @@ public string ToString(string? format) return ToString(format, null); } - /// + /// /// /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. /// - /// The format string. - /// Format to use for localization and number formatting. Defaults to if null. - /// The string representation. public string ToString(string? format, IFormatProvider? provider) { - return QuantityFormatter.Format(this, format, provider); + return QuantityFormatter.Default.Format(this, format, provider); } #endregion diff --git a/UnitsNet/IQuantity.cs b/UnitsNet/IQuantity.cs index d9e6c2c221..6fa31d6d51 100644 --- a/UnitsNet/IQuantity.cs +++ b/UnitsNet/IQuantity.cs @@ -99,6 +99,15 @@ public interface IQuantity : IFormattable /// String representation. /// Format to use for localization and number formatting. Defaults to if null. string ToString(IFormatProvider? provider); + + /// + /// Gets the unique key for the unit type and its corresponding value. + /// + /// + /// This property is particularly useful when using an enum-based unit in a hash-based collection, + /// as it avoids the boxing that would normally occur when casting the enum to . + /// + UnitKey UnitKey { get; } } /// diff --git a/UnitsNet/QuantityFormatter.cs b/UnitsNet/QuantityFormatter.cs index 38f6cdc36b..af2ff1cf22 100644 --- a/UnitsNet/QuantityFormatter.cs +++ b/UnitsNet/QuantityFormatter.cs @@ -2,6 +2,7 @@ // 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; namespace UnitsNet; @@ -11,63 +12,42 @@ namespace UnitsNet; /// public class QuantityFormatter { + private readonly UnitAbbreviationsCache _unitAbbreviations; + /// - /// Formats a quantity using the given format string and format provider. + /// Initializes a new instance of the class. /// - /// The quantity to format. - /// The format string. - /// - /// The valid format strings are as follows: - /// - /// - /// A standard numeric format string. - /// - /// Any of the - /// - /// Standard format specifiers - /// . - /// - /// - /// - /// "A" or "a". - /// The default unit abbreviation for , such as "m". - /// - /// - /// "A0", "A1", ..., "An" or "a0", "a1", ..., "an". - /// - /// The n-th unit abbreviation for the . "a0" is the same as "a". - /// A will be thrown if the requested abbreviation index does not exist. - /// - /// - /// - /// "S" or "s". - /// - /// The value with 2 significant digits after the radix followed by the unit abbreviation, such as - /// "1.23 m". - /// - /// - /// - /// "S0", "S1", ..., "Sn" or "s0", "s1", ..., "sn". - /// - /// The value with n significant digits after the radix followed by the unit abbreviation. "S2" - /// and "s2" is the same as "s". - /// - /// - /// - /// For more information about the formatter, see the - /// - /// QuantityFormatter - /// section - /// . - /// - /// The string representation. - /// Thrown when the format specifier is invalid. + /// The cache of unit abbreviations used for formatting quantities. + public QuantityFormatter(UnitAbbreviationsCache unitAbbreviations) + { + _unitAbbreviations = unitAbbreviations ?? throw new ArgumentNullException(nameof(unitAbbreviations)); + } + + /// + /// Gets the default instance of the class. + /// + /// + /// The default instance, initialized with the default + /// . + /// + public static QuantityFormatter Default => UnitsNetSetup.Default.Formatter; + + /// + [Obsolete("Consider switching to one of the more performant instance methods available on QuantityFormatter.Default.")] public static string Format(IQuantity quantity, string format) where TUnitType : struct, Enum { return Format(quantity, format, CultureInfo.CurrentCulture); } + /// + [Obsolete("Consider switching to one of the more performant instance methods available on QuantityFormatter.Default.")] + public static string Format(IQuantity quantity, string? format, IFormatProvider? formatProvider) + where TUnitType : struct, Enum + { + return Default.Format(quantity, format, formatProvider); + } + /// /// Formats a quantity using the given format string and format provider. /// @@ -84,9 +64,11 @@ public static string Format(IQuantity quantity, string for /// A standard numeric format string. /// /// Any of the - /// + /// /// Standard format specifiers - /// . + /// + /// . /// /// /// @@ -97,7 +79,10 @@ public static string Format(IQuantity quantity, string for /// "A0", "A1", ..., "An" or "a0", "a1", ..., "an". /// /// The n-th unit abbreviation for the . "a0" is the same as "a". - /// A will be thrown if the requested abbreviation index does not exist. + /// + /// A will be thrown if the requested abbreviation index does not + /// exist. + /// /// /// /// @@ -119,18 +104,13 @@ public static string Format(IQuantity quantity, string for /// /// QuantityFormatter /// section - /// . + /// + /// . /// /// The string representation. /// Thrown when the format specifier is invalid. - public static string Format(IQuantity quantity, string? format, IFormatProvider? formatProvider) - where TUnitType : struct, Enum - { - return FormatUntrimmed(quantity, format, formatProvider).TrimEnd(); - } - - private static string FormatUntrimmed(IQuantity quantity, string? format, IFormatProvider? formatProvider) - where TUnitType : struct, Enum + public string Format(TQuantity quantity, string? format = null, IFormatProvider? formatProvider = null) + where TQuantity : IQuantity { formatProvider ??= CultureInfo.CurrentCulture; if (format is null) @@ -146,7 +126,7 @@ private static string FormatUntrimmed(IQuantity quantity, case 'S' or 's': return ToStringWithSignificantDigitsAfterRadix(quantity, formatProvider, 0); case 'A' or 'a': - return UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(quantity.Unit, formatProvider); + return _unitAbbreviations.GetDefaultAbbreviation(quantity.UnitKey, formatProvider); case 'U' or 'u': throw new FormatException($"The \"{format}\" format is no longer supported: consider using the Unit property."); case 'V' or 'v': @@ -168,7 +148,7 @@ private static string FormatUntrimmed(IQuantity quantity, return ToStringWithSignificantDigitsAfterRadix(quantity, formatProvider, precisionSpecifier); case 'A' or 'a' when int.TryParse(format.AsSpan(1), out var abbreviationIndex): { - var abbreviations = UnitsNetSetup.Default.UnitAbbreviations.GetUnitAbbreviations(quantity.Unit, formatProvider); + IReadOnlyList abbreviations = _unitAbbreviations.GetUnitAbbreviations(quantity.UnitKey, formatProvider); if (abbreviationIndex >= abbreviations.Count) { @@ -186,7 +166,7 @@ private static string FormatUntrimmed(IQuantity quantity, return ToStringWithSignificantDigitsAfterRadix(quantity, formatProvider, precisionSpecifier); case 'A' or 'a' when int.TryParse(format.Substring(1), out var abbreviationIndex): { - var abbreviations = UnitsNetSetup.Default.UnitAbbreviations.GetUnitAbbreviations(quantity.Unit, formatProvider); + IReadOnlyList abbreviations = _unitAbbreviations.GetUnitAbbreviations(quantity.UnitKey, formatProvider); if (abbreviationIndex >= abbreviations.Count) { @@ -206,19 +186,30 @@ private static string FormatUntrimmed(IQuantity quantity, // Anything else is a standard numeric format string with default unit abbreviation postfix. return FormatWithValueAndAbbreviation(quantity, format, formatProvider); } - - private static string FormatWithValueAndAbbreviation(IQuantity quantity, string format, IFormatProvider formatProvider) - where TUnitType : struct, Enum + + private string FormatWithValueAndAbbreviation(TQuantity quantity, string format, IFormatProvider formatProvider) + where TQuantity : IQuantity { - var abbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(quantity.Unit, formatProvider); - return string.Format(formatProvider, $"{{0:{format}}} {{1}}", quantity.Value, abbreviation); + var abbreviation = _unitAbbreviations.GetDefaultAbbreviation(quantity.UnitKey, formatProvider); + if (abbreviation.Length == 0) + { + return quantity.Value.ToString(format, formatProvider); + } + +#if NET + // TODO see about using the Span overloads (net 8+) + return quantity.Value.ToString(format, formatProvider) + ' ' + abbreviation; +#else + return quantity.Value.ToString(format, formatProvider) + ' ' + abbreviation; +#endif } - private static string ToStringWithSignificantDigitsAfterRadix(IQuantity quantity, IFormatProvider formatProvider, int number) - where TUnitType : struct, Enum + private string ToStringWithSignificantDigitsAfterRadix(TQuantity quantity, IFormatProvider formatProvider, int number) + where TQuantity : IQuantity { var formatForSignificantDigits = UnitFormatter.GetFormat(quantity.Value, number); - var formatArgs = UnitFormatter.GetFormatArgs(quantity.Unit, quantity.Value, formatProvider, []); - return string.Format(formatProvider, formatForSignificantDigits, formatArgs); + var abbreviation = _unitAbbreviations.GetDefaultAbbreviation(quantity.UnitKey, formatProvider); + var formatArgs = UnitFormatter.GetFormatArgs(quantity.Value, abbreviation, formatProvider, []); + return string.Format(formatProvider, formatForSignificantDigits, formatArgs).TrimEnd(); } } diff --git a/UnitsNet/UnitFormatter.cs b/UnitsNet/UnitFormatter.cs index df359557e6..0a2b827951 100644 --- a/UnitsNet/UnitFormatter.cs +++ b/UnitsNet/UnitFormatter.cs @@ -64,16 +64,13 @@ private static bool NearlyEqual(double a, double b) /// /// Gets ToString format arguments. /// - /// The type of units to format. - /// The units + /// The unit abbreviation /// The unit value to format. /// The current culture. /// The list of format arguments. /// An array of ToString format arguments. - public static object[] GetFormatArgs(TUnitType unit, double value, IFormatProvider? culture, IEnumerable args) - where TUnitType : struct, Enum + public static object[] GetFormatArgs(double value, string abbreviation, IFormatProvider? culture, IEnumerable args) { - string abbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(unit, culture); return new object[] {value, abbreviation}.Concat(args).ToArray(); } }