Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 3db8384

Browse files
stephentoubjkotas
authored andcommitted
Fix default style argument to Double/Single/Decimal.Parse (#17556)
1 parent 5b1c670 commit 3db8384

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/mscorlib/shared/System/Double.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public static double Parse(String s, NumberStyles style, IFormatProvider provide
297297
// PositiveInfinity or NegativeInfinity for a number that is too
298298
// large or too small.
299299

300-
public static double Parse(ReadOnlySpan<char> s, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null)
300+
public static double Parse(ReadOnlySpan<char> s, NumberStyles style = NumberStyles.Float | NumberStyles.AllowThousands, IFormatProvider provider = null)
301301
{
302302
NumberFormatInfo.ValidateParseStyleFloatingPoint(style);
303303
return Number.ParseDouble(s, style, NumberFormatInfo.GetInstance(provider));

src/mscorlib/shared/System/Single.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ public static float Parse(String s, NumberStyles style, IFormatProvider provider
288288
return Number.ParseSingle(s, style, NumberFormatInfo.GetInstance(provider));
289289
}
290290

291-
public static float Parse(ReadOnlySpan<char> s, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null)
291+
public static float Parse(ReadOnlySpan<char> s, NumberStyles style = NumberStyles.Float | NumberStyles.AllowThousands, IFormatProvider provider = null)
292292
{
293293
NumberFormatInfo.ValidateParseStyleFloatingPoint(style);
294294
return Number.ParseSingle(s, style, NumberFormatInfo.GetInstance(provider));

src/mscorlib/src/System/Decimal.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ public static Decimal Parse(String s, NumberStyles style, IFormatProvider provid
539539
return Number.ParseDecimal(s, style, NumberFormatInfo.GetInstance(provider));
540540
}
541541

542-
public static decimal Parse(ReadOnlySpan<char> s, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null)
542+
public static decimal Parse(ReadOnlySpan<char> s, NumberStyles style = NumberStyles.Number, IFormatProvider provider = null)
543543
{
544544
NumberFormatInfo.ValidateParseStyleFloatingPoint(style);
545545
return Number.ParseDecimal(s, style, NumberFormatInfo.GetInstance(provider));

0 commit comments

Comments
 (0)