Skip to content

Commit 58ce961

Browse files
committed
Added a method to set the Global default IFormatProvider selector
1 parent d6629f7 commit 58ce961

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/IGLib.Core/Console/Validation/DefaultFormatProvider/DefaultFormatProvider.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ public class DefaultFormatProviderSelector
1616
public static IDefaultFormatProviderSelector Global { get; private set; }
1717
= new DefaultFormatProviderSelectorInvariantCulture();
1818

19+
public static void SetGlobal(IDefaultFormatProviderSelector selector)
20+
{
21+
if (selector == null)
22+
{
23+
throw new ArgumentNullException(nameof(selector), "The global selector of default format provider cannot be set to null.");
24+
}
25+
Global = selector;
26+
}
27+
1928
/// <summary>Returns the appropriate <see cref="IFormatProvider"/> according to the specified (suggested)
2029
/// <paramref name="specifiedFormatProvider"/> (that can be null) and the specified <paramref name="defaultSelector"/>,
2130
/// which provides the default <see cref="IFormatProvider"/> when the <paramref name="specifiedFormatProvider"/>

0 commit comments

Comments
 (0)