Skip to content

Commit 0837623

Browse files
committed
UnitSystem: Make DefaultCulture settable
Except in WinRTC, which does not support IFormatProvider type.
1 parent 446c720 commit 0837623

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

UnitsNet/CustomCode/UnitSystem.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,15 @@ public UnitSystem() : this(DefaultCulture)
137137

138138
/// <summary>
139139
/// Defaults to <see cref="CultureInfo.CurrentUICulture" /> when creating an instance with no culture provided.
140+
/// Can be overridden, but note that this is static and will affect all subsequent usages.
140141
/// </summary>
141-
private static IFormatProvider DefaultCulture => CultureInfo.CurrentUICulture;
142+
#if WINDOWS_UWP
143+
// Windows Runtime Component does not support exposing the IFormatProvider type in public API
144+
internal
145+
#else
146+
public
147+
#endif
148+
static IFormatProvider DefaultCulture { get; set; } = CultureInfo.CurrentUICulture;
142149

143150
public bool IsFallbackCulture => Culture.Equals(FallbackCulture);
144151

0 commit comments

Comments
 (0)