@@ -247,10 +247,7 @@ private static bool TryParseBool(string json, ref int offset, out bool output)
247247 switch ( json [ offset ] )
248248 {
249249 case 't' :
250- if ( offset < json . Length - 3 &&
251- json [ offset + 1 ] == 'r' &&
252- json [ offset + 2 ] == 'u' &&
253- json [ offset + 3 ] == 'e' )
250+ if ( offset < json . Length - 3 && json . Substring ( offset , 4 ) == "true" )
254251 {
255252 offset += 4 ;
256253 output = true ;
@@ -260,11 +257,7 @@ private static bool TryParseBool(string json, ref int offset, out bool output)
260257 break ;
261258
262259 case 'f' :
263- if ( offset < json . Length - 4 &&
264- json [ offset + 1 ] == 'a' &&
265- json [ offset + 2 ] == 'l' &&
266- json [ offset + 3 ] == 's' &&
267- json [ offset + 4 ] == 'e' )
260+ if ( offset < json . Length - 4 && json . Substring ( offset , 5 ) == "false" )
268261 {
269262 offset += 5 ;
270263 return true ;
@@ -279,11 +272,7 @@ private static bool TryParseBool(string json, ref int offset, out bool output)
279272
280273 private static bool TryParseNull ( string json , ref int offset )
281274 {
282- if ( offset < json . Length - 3 &&
283- json [ offset ] == 'n' &&
284- json [ offset + 1 ] == 'u' &&
285- json [ offset + 2 ] == 'l' &&
286- json [ offset + 3 ] == 'l' )
275+ if ( offset < json . Length - 3 && json . Substring ( offset , 4 ) == "null" )
287276 {
288277 offset += 4 ;
289278 return true ;
0 commit comments