Skip to content

Commit 81c3b87

Browse files
committed
Add Configuration.ResetOptions()
1 parent a7ace64 commit 81c3b87

1 file changed

Lines changed: 20 additions & 13 deletions

File tree

Src/Configuration.cs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,7 @@ public class Configuration : IEnumerable<Section>
3030

3131
static Configuration()
3232
{
33-
// For now, clone the invariant culture so that the
34-
// deprecated DateTimeFormat/NumberFormat properties still work,
35-
// but without modifying the real invariant culture instance.
36-
s_cultureInfo = (CultureInfo)CultureInfo.InvariantCulture.Clone();
37-
38-
ValidCommentChars = new HashSet<char> { '#', ';' };
39-
s_preferredCommentChar = '#';
40-
s_arrayElementSeparator = ',';
33+
ResetOptions();
4134

4235
FallbackConverter = new FallbackStringConverter();
4336

@@ -60,11 +53,6 @@ static Configuration()
6053
{ typeof(uint), new UInt32StringConverter() },
6154
{ typeof(ulong), new UInt64StringConverter() },
6255
};
63-
64-
IgnoreInlineComments = false;
65-
IgnorePreComments = false;
66-
SpaceBetweenEquals = false;
67-
OutputRawStringValues = false;
6856
}
6957

7058
/// <summary>
@@ -660,6 +648,25 @@ public static char ArrayElementSeparator
660648
/// </summary>
661649
public static bool SpaceBetweenEquals { get; set; }
662650

651+
/// <summary>
652+
/// Resets all global configuration options to their defaults.
653+
/// </summary>
654+
public static void ResetOptions()
655+
{
656+
// For now, clone the invariant culture so that the
657+
// deprecated DateTimeFormat/NumberFormat properties still work,
658+
// but without modifying the real invariant culture instance.
659+
s_cultureInfo = (CultureInfo)CultureInfo.InvariantCulture.Clone();
660+
661+
ValidCommentChars = new HashSet<char> { '#', ';' };
662+
s_preferredCommentChar = '#';
663+
s_arrayElementSeparator = ',';
664+
OutputRawStringValues = false;
665+
IgnoreInlineComments = false;
666+
IgnorePreComments = false;
667+
SpaceBetweenEquals = false;
668+
}
669+
663670
/// <summary>
664671
/// Gets the number of sections that are in the configuration.
665672
/// </summary>

0 commit comments

Comments
 (0)