Skip to content

Commit

Permalink
Un-obsolete static Default getters (#1481)
Browse files Browse the repository at this point in the history
Per [discussion
](#1475 (comment))
in v6, we no longer want to remove these.

Already reverted in v6 with #1480
  • Loading branch information
angularsen authored Dec 29, 2024
1 parent b3f04ec commit bb1420e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
6 changes: 4 additions & 2 deletions UnitsNet/CustomCode/QuantityParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ public class QuantityParser
private readonly UnitParser _unitParser;

/// <summary>
/// The default instance of <see cref="QuantityParser"/>, which uses <see cref="UnitsNetSetup"/>.<see cref="UnitsNetSetup.Default"/>.<see cref="UnitsNetSetup.UnitAbbreviations"/>.
/// The default singleton instance for parsing quantities.
/// </summary>
[Obsolete("Use UnitsNetSetup.Default.QuantityParser instead.")]
/// <remarks>
/// Convenience shortcut for <see cref="UnitsNetSetup"/>.<see cref="UnitsNetSetup.Default"/>.<see cref="UnitsNetSetup.QuantityParser"/>.
/// </remarks>
public static QuantityParser Default => UnitsNetSetup.Default.QuantityParser;

/// <summary>
Expand Down
7 changes: 5 additions & 2 deletions UnitsNet/CustomCode/UnitAbbreviationsCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ public sealed class UnitAbbreviationsCache
internal static readonly CultureInfo FallbackCulture = CultureInfo.InvariantCulture;

/// <summary>
/// The static instance used internally for ToString() and Parse() of quantities and units.
/// The default singleton instance with the default configured unit abbreviations, used for ToString() and parsing of quantities and units.
/// </summary>
[Obsolete("Use UnitsNetSetup.Default.UnitAbbreviations instead.")]
/// <remarks>
/// Convenience shortcut for <see cref="UnitsNetSetup"/>.<see cref="UnitsNetSetup.Default"/>.<see cref="UnitsNetSetup.UnitAbbreviations"/>.<br />
/// You can add custom unit abbreviations at runtime, and this will affect all usages globally in the application.
/// </remarks>
public static UnitAbbreviationsCache Default => UnitsNetSetup.Default.UnitAbbreviations;

private QuantityInfoLookup QuantityInfoLookup { get; }
Expand Down
7 changes: 4 additions & 3 deletions UnitsNet/CustomCode/UnitParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ public sealed class UnitParser
private readonly UnitAbbreviationsCache _unitAbbreviationsCache;

/// <summary>
/// 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.
/// The default singleton instance for parsing units from the default configured unit abbreviations.
/// </summary>
[Obsolete("Use UnitsNetSetup.Default.UnitParser instead.")]
/// <remarks>
/// Convenience shortcut for <see cref="UnitsNetSetup"/>.<see cref="UnitsNetSetup.Default"/>.<see cref="UnitsNetSetup.UnitParser"/>.
/// </remarks>
public static UnitParser Default => UnitsNetSetup.Default.UnitParser;

/// <summary>
Expand Down
8 changes: 5 additions & 3 deletions UnitsNet/UnitConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ public delegate TQuantity ConversionFunction<TQuantity>(TQuantity inputValue)
public sealed class UnitConverter
{
/// <summary>
/// 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.
/// The default singleton instance for converting values from one unit to another.<br />
/// Modify this to add/remove conversion functions at runtime, such as adding your own third-party units and quantities to convert between.
/// </summary>
[Obsolete("Use UnitsNetSetup.Default.UnitConverter instead.")]
/// <remarks>
/// Convenience shortcut for <see cref="UnitsNetSetup"/>.<see cref="UnitsNetSetup.Default"/>.<see cref="UnitsNetSetup.UnitConverter"/>.
/// </remarks>
public static UnitConverter Default => UnitsNetSetup.Default.UnitConverter;

/// <summary>
Expand Down

0 comments on commit bb1420e

Please sign in to comment.