Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit d8ed1fd

Browse files
committed
Return InvariantCulture in system parse methods
1 parent c585996 commit d8ed1fd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/ServiceStack.Text/Support/StringSegmentExtensions.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,58 +122,58 @@ enum ParseState
122122
public static sbyte ParseSByte(this StringSegment value)
123123
{
124124
return JsConfig.UseSystemParseMethods
125-
? sbyte.Parse(value.Value)
125+
? sbyte.Parse(value.Value, CultureInfo.InvariantCulture)
126126
: (sbyte) ParseSignedInteger(value, sbyte.MaxValue, sbyte.MinValue);
127127
}
128128

129129
public static byte ParseByte(this StringSegment value)
130130
{
131131
return JsConfig.UseSystemParseMethods
132-
? byte.Parse(value.Value)
132+
? byte.Parse(value.Value, CultureInfo.InvariantCulture)
133133
: (byte) ParseUnsignedInteger(value, byte.MaxValue);
134134
}
135135

136136
public static short ParseInt16(this StringSegment value)
137137
{
138138
return JsConfig.UseSystemParseMethods
139-
? short.Parse(value.Value)
139+
? short.Parse(value.Value, CultureInfo.InvariantCulture)
140140
: (short) ParseSignedInteger(value, short.MaxValue, short.MinValue);
141141
}
142142

143143
public static ushort ParseUInt16(this StringSegment value)
144144
{
145145
return JsConfig.UseSystemParseMethods
146-
? ushort.Parse(value.Value)
146+
? ushort.Parse(value.Value, CultureInfo.InvariantCulture)
147147
: (ushort) ParseUnsignedInteger(value, ushort.MaxValue);
148148
}
149149

150150

151151
public static int ParseInt32(this StringSegment value)
152152
{
153153
return JsConfig.UseSystemParseMethods
154-
? int.Parse(value.Value)
154+
? int.Parse(value.Value, CultureInfo.InvariantCulture)
155155
: (int) ParseSignedInteger(value, Int32.MaxValue, Int32.MinValue);
156156
}
157157

158158
public static uint ParseUInt32(this StringSegment value)
159159
{
160160
return JsConfig.UseSystemParseMethods
161-
? uint.Parse(value.Value)
161+
? uint.Parse(value.Value, CultureInfo.InvariantCulture)
162162
: (uint) ParseUnsignedInteger(value, UInt32.MaxValue);
163163
}
164164

165165
public static long ParseInt64(this StringSegment value)
166166
{
167167
return JsConfig.UseSystemParseMethods
168-
? long.Parse(value.Value)
168+
? long.Parse(value.Value, CultureInfo.InvariantCulture)
169169
: ParseSignedInteger(value, Int64.MaxValue, Int64.MinValue);
170170

171171
}
172172

173173
public static ulong ParseUInt64(this StringSegment value)
174174
{
175175
return JsConfig.UseSystemParseMethods
176-
? ulong.Parse(value.Value)
176+
? ulong.Parse(value.Value, CultureInfo.InvariantCulture)
177177
: ParseUnsignedInteger(value, UInt64.MaxValue);
178178
}
179179

0 commit comments

Comments
 (0)