From ce11086416b26dea3802335397945fe04609af30 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 27 Dec 2024 23:56:55 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5Remove=20static=20Default=20getters?= =?UTF-8?q?,=20obsoleted=20by=20UnitsNetSetup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UnitsNet/CustomCode/QuantityParser.cs | 6 ------ UnitsNet/CustomCode/UnitAbbreviationsCache.cs | 6 ------ UnitsNet/CustomCode/UnitParser.cs | 13 +++---------- UnitsNet/UnitConverter.cs | 8 -------- 4 files changed, 3 insertions(+), 30 deletions(-) diff --git a/UnitsNet/CustomCode/QuantityParser.cs b/UnitsNet/CustomCode/QuantityParser.cs index e91d5416d6..5168725905 100644 --- a/UnitsNet/CustomCode/QuantityParser.cs +++ b/UnitsNet/CustomCode/QuantityParser.cs @@ -34,12 +34,6 @@ public class QuantityParser private readonly UnitAbbreviationsCache _unitAbbreviationsCache; private readonly UnitParser _unitParser; - /// - /// The default instance of , which uses ... - /// - [Obsolete("Use UnitsNetSetup.Default.QuantityParser instead.")] - public static QuantityParser Default => UnitsNetSetup.Default.QuantityParser; - /// /// Creates an instance of , optionally specifying an /// with unit abbreviations to use when parsing. diff --git a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs index 81e1ed0d23..ee56cf7925 100644 --- a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs +++ b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs @@ -31,12 +31,6 @@ public sealed class UnitAbbreviationsCache /// internal static readonly CultureInfo FallbackCulture = CultureInfo.InvariantCulture; - /// - /// The static instance used internally for ToString() and Parse() of quantities and units. - /// - [Obsolete("Use UnitsNetSetup.Default.UnitAbbreviations instead.")] - public static UnitAbbreviationsCache Default => UnitsNetSetup.Default.UnitAbbreviations; - private QuantityInfoLookup QuantityInfoLookup { get; } /// diff --git a/UnitsNet/CustomCode/UnitParser.cs b/UnitsNet/CustomCode/UnitParser.cs index 8159a99e5c..aecc6d526d 100644 --- a/UnitsNet/CustomCode/UnitParser.cs +++ b/UnitsNet/CustomCode/UnitParser.cs @@ -13,20 +13,13 @@ namespace UnitsNet { /// /// Parses units given a unit abbreviations cache. - /// The static instance is used internally to parse quantities and units using the - /// default abbreviations cache for all units and abbreviations defined in the library. + /// A static instance .. is used internally + /// to parse quantities and units using the default abbreviations cache for all units and abbreviations defined in the library. /// public sealed class UnitParser { private readonly UnitAbbreviationsCache _unitAbbreviationsCache; - /// - /// The default static instance used internally to parse quantities and units using the - /// default abbreviations cache for all units and abbreviations defined in the library. - /// - [Obsolete("Use UnitsNetSetup.Default.UnitParser instead.")] - public static UnitParser Default => UnitsNetSetup.Default.UnitParser; - /// /// Create a parser using the given unit abbreviations cache. /// @@ -205,7 +198,7 @@ public bool TryParse([NotNullWhen(true)] string? unitAbbreviation, Type unitType { return false; } - + unit = matches[0].Unit; return true; } diff --git a/UnitsNet/UnitConverter.cs b/UnitsNet/UnitConverter.cs index 0f5e9ebd5b..442a20ae86 100644 --- a/UnitsNet/UnitConverter.cs +++ b/UnitsNet/UnitConverter.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Concurrent; using System.Diagnostics.CodeAnalysis; -using System.Globalization; using System.Reflection; using System.Linq; using UnitsNet.InternalHelpers; @@ -35,13 +34,6 @@ public delegate TQuantity ConversionFunction(TQuantity inputValue) /// public sealed class UnitConverter { - /// - /// The static instance used by Units.NET to convert between units. Modify this to add/remove conversion functions at runtime, such - /// as adding your own third-party units and quantities to convert between. - /// - [Obsolete("Use UnitsNetSetup.Default.UnitConverter instead.")] - public static UnitConverter Default => UnitsNetSetup.Default.UnitConverter; - /// /// Creates a new instance. ///