Skip to content

Commit 9b9c5b2

Browse files
committed
Make types internal
UnitFormatter and Constants were not intended to be public in the first place. Kind of breaks backwards compatibility, but I really don't expect anyone to have a good reason using these.
1 parent 4575f6c commit 9b9c5b2

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

UnitsNet/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
namespace UnitsNet
2323
{
24-
public static class Constants
24+
internal static class Constants
2525
{
2626
public const double Gravity = 9.80665002864;
2727
}

UnitsNet/UnitFormatter.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@
2020
// THE SOFTWARE.
2121

2222
using System;
23+
using System.Collections.Generic;
2324
using System.Globalization;
2425
using System.Linq;
26+
using JetBrains.Annotations;
2527

2628
namespace UnitsNet
2729
{
2830
/// <summary>
2931
/// Utility class for formatting units and values.
3032
/// </summary>
31-
public static class UnitFormatter
33+
internal static class UnitFormatter
3234
{
3335
/// <summary>
3436
/// Gets the default ToString format for the specified value.
@@ -88,11 +90,11 @@ private static bool NearlyEqual(double a, double b)
8890
/// <param name="culture">The current culture.</param>
8991
/// <param name="args">The list of format arguments.</param>
9092
/// <returns>An array of ToString format arguments.</returns>
91-
public static object[] GetFormatArgs<TUnit>(TUnit unit, double value, CultureInfo culture, object[] args)
93+
public static object[] GetFormatArgs<TUnit>(TUnit unit, double value, [CanBeNull] CultureInfo culture, IEnumerable<object> args)
9294
where TUnit : struct, IComparable, IFormattable
9395
{
94-
string abbreviation = UnitSystem.GetCached(culture).GetDefaultAbbreviation(unit);
95-
return new object[] {value, abbreviation}.Concat(args).ToArray();
96+
string abbreviation = UnitSystem.GetCached(culture).GetDefaultAbbreviation(typeof(TUnit), Convert.ToInt32(unit));
97+
return new object[] { value, abbreviation }.Concat(args).ToArray();
9698
}
9799
}
98100
}

0 commit comments

Comments
 (0)