Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥Remove static Default getters, obsoleted by UnitsNetSetup #1475

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions UnitsNet/CustomCode/QuantityParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ public class QuantityParser
private readonly UnitAbbreviationsCache _unitAbbreviationsCache;
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"/>.
/// </summary>
[Obsolete("Use UnitsNetSetup.Default.QuantityParser instead.")]
public static QuantityParser Default => UnitsNetSetup.Default.QuantityParser;

/// <summary>
/// Creates an instance of <see cref="QuantityParser"/>, optionally specifying an <see cref="UnitAbbreviationsCache"/>
/// with unit abbreviations to use when parsing.
Expand Down
6 changes: 0 additions & 6 deletions UnitsNet/CustomCode/UnitAbbreviationsCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ public sealed class UnitAbbreviationsCache
/// </example>
internal static readonly CultureInfo FallbackCulture = CultureInfo.InvariantCulture;

/// <summary>
/// The static instance used internally for ToString() and Parse() of quantities and units.
/// </summary>
[Obsolete("Use UnitsNetSetup.Default.UnitAbbreviations instead.")]
public static UnitAbbreviationsCache Default => UnitsNetSetup.Default.UnitAbbreviations;

private QuantityInfoLookup QuantityInfoLookup { get; }

/// <summary>
Expand Down
13 changes: 3 additions & 10 deletions UnitsNet/CustomCode/UnitParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,13 @@ namespace UnitsNet
{
/// <summary>
/// Parses units given a unit abbreviations cache.
/// The static instance <see cref="Default"/> 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 <see cref="UnitsNetSetup"/>.<see cref="UnitsNetSetup.Default"/>.<see cref="UnitsNetSetup.UnitParser"/> is used internally
/// to parse quantities and units using the default abbreviations cache for all units and abbreviations defined in the library.
/// </summary>
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.
/// </summary>
[Obsolete("Use UnitsNetSetup.Default.UnitParser instead.")]
public static UnitParser Default => UnitsNetSetup.Default.UnitParser;

/// <summary>
/// Create a parser using the given unit abbreviations cache.
/// </summary>
Expand Down Expand Up @@ -205,7 +198,7 @@ public bool TryParse([NotNullWhen(true)] string? unitAbbreviation, Type unitType
{
return false;
}

unit = matches[0].Unit;
return true;
}
Expand Down
8 changes: 0 additions & 8 deletions UnitsNet/UnitConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -35,13 +34,6 @@ public delegate TQuantity ConversionFunction<TQuantity>(TQuantity inputValue)
/// </summary>
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.
/// </summary>
[Obsolete("Use UnitsNetSetup.Default.UnitConverter instead.")]
public static UnitConverter Default => UnitsNetSetup.Default.UnitConverter;

/// <summary>
/// Creates a new <see cref="UnitConverter"/> instance.
/// </summary>
Expand Down