diff --git a/UnitsNet/CustomCode/QuantityParser.cs b/UnitsNet/CustomCode/QuantityParser.cs index 8b81271b9a..eb88e4f078 100644 --- a/UnitsNet/CustomCode/QuantityParser.cs +++ b/UnitsNet/CustomCode/QuantityParser.cs @@ -34,6 +34,14 @@ public class QuantityParser private readonly UnitAbbreviationsCache _unitAbbreviationsCache; private readonly UnitParser _unitParser; + /// + /// The default singleton instance for parsing quantities. + /// + /// + /// Convenience shortcut for ... + /// + 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 8930779be4..6cfbff7967 100644 --- a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs +++ b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs @@ -31,6 +31,15 @@ public sealed class UnitAbbreviationsCache /// internal static readonly CultureInfo FallbackCulture = CultureInfo.InvariantCulture; + /// + /// The default singleton instance with the default configured unit abbreviations, used for ToString() and parsing of quantities and units. + /// + /// + /// Convenience shortcut for ...
+ /// You can add custom unit abbreviations at runtime, and this will affect all usages globally in the application. + ///
+ public static UnitAbbreviationsCache Default => UnitsNetSetup.Default.UnitAbbreviations; + private QuantityInfoLookup QuantityInfoLookup { get; } /// diff --git a/UnitsNet/CustomCode/UnitParser.cs b/UnitsNet/CustomCode/UnitParser.cs index ec4029d7a8..e55fdaf2b6 100644 --- a/UnitsNet/CustomCode/UnitParser.cs +++ b/UnitsNet/CustomCode/UnitParser.cs @@ -13,13 +13,21 @@ namespace UnitsNet { /// /// Parses units given a unit abbreviations cache. - /// 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. + /// 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. /// public sealed class UnitParser { private readonly UnitAbbreviationsCache _unitAbbreviationsCache; + /// + /// The default singleton instance for parsing units from the default configured unit abbreviations. + /// + /// + /// Convenience shortcut for ... + /// + public static UnitParser Default => UnitsNetSetup.Default.UnitParser; + /// /// Create a parser using the given unit abbreviations cache. /// diff --git a/UnitsNet/UnitConverter.cs b/UnitsNet/UnitConverter.cs index 442a20ae86..5a8c1e917f 100644 --- a/UnitsNet/UnitConverter.cs +++ b/UnitsNet/UnitConverter.cs @@ -34,6 +34,15 @@ public delegate TQuantity ConversionFunction(TQuantity inputValue) /// public sealed class UnitConverter { + /// + /// The default singleton instance for converting values from one unit to another.
+ /// Modify this to add/remove conversion functions at runtime, such as adding your own third-party units and quantities to convert between. + ///
+ /// + /// Convenience shortcut for ... + /// + public static UnitConverter Default => UnitsNetSetup.Default.UnitConverter; + /// /// Creates a new instance. ///