From c876e1d9cc2d53ff5143423d4d047a7cf3136340 Mon Sep 17 00:00:00 2001 From: JamesNK Date: Sat, 18 Feb 2012 01:04:50 +0000 Subject: [PATCH] -Fixed reading scientific notation numbers with no decimal point -Changed the ReadAsXXX methods to return null at the end of an array instead of throwing an error --- .../JsonTextReaderTest.cs | 84 ++++++++++++++++++- .../JsonValidatingReaderTests.cs | 71 ++++++++++------ .../Properties/AssemblyInfo.cs | 2 +- Src/Newtonsoft.Json/Bson/BsonReader.cs | 16 ++-- Src/Newtonsoft.Json/JsonReader.cs | 19 +---- Src/Newtonsoft.Json/JsonTextReader.cs | 21 +++-- Src/Newtonsoft.Json/Linq/JTokenReader.cs | 18 ++-- .../Properties/AssemblyInfo.cs | 2 +- .../JsonSerializerInternalReader.cs | 18 ---- 9 files changed, 163 insertions(+), 88 deletions(-) diff --git a/Src/Newtonsoft.Json.Tests/JsonTextReaderTest.cs b/Src/Newtonsoft.Json.Tests/JsonTextReaderTest.cs index a1cb8572..987489df 100644 --- a/Src/Newtonsoft.Json.Tests/JsonTextReaderTest.cs +++ b/Src/Newtonsoft.Json.Tests/JsonTextReaderTest.cs @@ -941,7 +941,7 @@ bye", reader.Value); public void ReadFloatingPointNumber() { string json = - @"[0.0,0.0,0.1,1.0,1.000001,1E-06,4.94065645841247E-324,Infinity,-Infinity,NaN,1.7976931348623157E+308,-1.7976931348623157E+308,Infinity,-Infinity,NaN]"; + @"[0.0,0.0,0.1,1.0,1.000001,1E-06,4.94065645841247E-324,Infinity,-Infinity,NaN,1.7976931348623157E+308,-1.7976931348623157E+308,Infinity,-Infinity,NaN,0e-10,0.25e-5,0.3e10]"; using (JsonReader jsonReader = new JsonTextReader(new StringReader(json))) { @@ -1008,6 +1008,18 @@ bye", reader.Value); Assert.AreEqual(JsonToken.Float, jsonReader.TokenType); Assert.AreEqual(double.NaN, jsonReader.Value); + jsonReader.Read(); + Assert.AreEqual(JsonToken.Float, jsonReader.TokenType); + Assert.AreEqual(0, jsonReader.Value); + + jsonReader.Read(); + Assert.AreEqual(JsonToken.Float, jsonReader.TokenType); + Assert.AreEqual(0.0000025, jsonReader.Value); + + jsonReader.Read(); + Assert.AreEqual(JsonToken.Float, jsonReader.TokenType); + Assert.AreEqual(3000000000, jsonReader.Value); + jsonReader.Read(); Assert.AreEqual(JsonToken.EndArray, jsonReader.TokenType); } @@ -1933,5 +1945,73 @@ bye", reader.Value); Assert.IsTrue(reader.Read()); reader.Read(); } + + [Test] + public void ScientificNotation() + { + double d; + + d = Convert.ToDouble("6.0221418e23"); + Console.WriteLine(d.ToString(new CultureInfo("fr-FR"))); + Console.WriteLine(d.ToString("0.#############################################################################")); + + //CultureInfo info = CultureInfo.GetCultureInfo("fr-FR"); + //Console.WriteLine(info.NumberFormat.NumberDecimalSeparator); + + string json = @"[0e-10,0E-10,0.25e-5,0.3e10,6.0221418e23]"; + + JsonTextReader reader = new JsonTextReader(new StringReader(json)); + + reader.Read(); + + reader.Read(); + Assert.AreEqual(JsonToken.Float, reader.TokenType); + Assert.AreEqual(0, reader.Value); + + reader.Read(); + Assert.AreEqual(JsonToken.Float, reader.TokenType); + Assert.AreEqual(0, reader.Value); + + reader.Read(); + Assert.AreEqual(JsonToken.Float, reader.TokenType); + Assert.AreEqual(0.0000025, reader.Value); + + reader.Read(); + Assert.AreEqual(JsonToken.Float, reader.TokenType); + Assert.AreEqual(3000000000, reader.Value); + + reader.Read(); + Assert.AreEqual(JsonToken.Float, reader.TokenType); + Assert.AreEqual(602214180000000000000000d, reader.Value); + + reader.Read(); + + + reader = new JsonTextReader(new StringReader(json)); + + reader.Read(); + + reader.ReadAsDecimal(); + Assert.AreEqual(JsonToken.Float, reader.TokenType); + Assert.AreEqual(0, reader.Value); + + reader.ReadAsDecimal(); + Assert.AreEqual(JsonToken.Float, reader.TokenType); + Assert.AreEqual(0, reader.Value); + + reader.ReadAsDecimal(); + Assert.AreEqual(JsonToken.Float, reader.TokenType); + Assert.AreEqual(0.0000025, reader.Value); + + reader.ReadAsDecimal(); + Assert.AreEqual(JsonToken.Float, reader.TokenType); + Assert.AreEqual(3000000000, reader.Value); + + reader.ReadAsDecimal(); + Assert.AreEqual(JsonToken.Float, reader.TokenType); + Assert.AreEqual(602214180000000000000000m, reader.Value); + + reader.Read(); + } } -} \ No newline at end of file +} diff --git a/Src/Newtonsoft.Json.Tests/JsonValidatingReaderTests.cs b/Src/Newtonsoft.Json.Tests/JsonValidatingReaderTests.cs index 68450697..ae065654 100644 --- a/Src/Newtonsoft.Json.Tests/JsonValidatingReaderTests.cs +++ b/Src/Newtonsoft.Json.Tests/JsonValidatingReaderTests.cs @@ -65,7 +65,7 @@ namespace Newtonsoft.Json.Tests Assert.IsTrue(reader.Read()); Assert.AreEqual(JsonToken.String, reader.TokenType); Assert.AreEqual("James", reader.Value.ToString()); - Assert.AreEqual(typeof(string), reader.ValueType); + Assert.AreEqual(typeof (string), reader.ValueType); Assert.AreEqual('"', reader.QuoteChar); Assert.IsTrue(reader.Read()); @@ -302,7 +302,7 @@ namespace Newtonsoft.Json.Tests } [Test] - [ExpectedException(typeof(JsonSchemaException), ExpectedMessage = "Integer 10 exceeds maximum value of 5. Line 1, position 2.")] + [ExpectedException(typeof (JsonSchemaException), ExpectedMessage = "Integer 10 exceeds maximum value of 5. Line 1, position 2.")] public void ThrowExceptionWhenNoValidationEventHandler() { string schemaJson = @"{ @@ -597,13 +597,13 @@ namespace Newtonsoft.Json.Tests Assert.IsTrue(reader.Read()); Assert.AreEqual(JsonToken.Boolean, reader.TokenType); Assert.AreEqual(@"Value false is not defined in enum. Line 1, position 11.", validationEventArgs.Message); - + Assert.IsTrue(reader.Read()); Assert.AreEqual(JsonToken.EndArray, reader.TokenType); Assert.IsNotNull(validationEventArgs); } - + [Test] public void ArrayCountGreaterThanMaximumItems() { @@ -887,7 +887,11 @@ namespace Newtonsoft.Json.Tests Json.Schema.ValidationEventArgs validationEventArgs = null; JsonValidatingReader reader = new JsonValidatingReader(new JsonTextReader(new StringReader(json))); - reader.ValidationEventHandler += (sender, args) => { validationEventArgs = args; errors.Add(validationEventArgs.Message); }; + reader.ValidationEventHandler += (sender, args) => + { + validationEventArgs = args; + errors.Add(validationEventArgs.Message); + }; reader.Schema = JsonSchema.Parse(schemaJson); Assert.IsTrue(reader.Read()); @@ -1175,7 +1179,11 @@ namespace Newtonsoft.Json.Tests List errors = new List(); JsonValidatingReader reader = new JsonValidatingReader(new JsonTextReader(new StringReader(json))); - reader.ValidationEventHandler += (sender, args) => { validationEventArgs = args; errors.Add(validationEventArgs.Message); }; + reader.ValidationEventHandler += (sender, args) => + { + validationEventArgs = args; + errors.Add(validationEventArgs.Message); + }; reader.Schema = secondSchema; Assert.IsTrue(reader.Read()); @@ -1232,7 +1240,7 @@ namespace Newtonsoft.Json.Tests Assert.AreEqual("three", reader.Value.ToString()); Assert.AreEqual(5, errors.Count); Assert.AreEqual("String 'three' is less than minimum length of 6. Line 6, position 25.", errors[4]); - + Assert.IsTrue(reader.Read()); Assert.AreEqual(JsonToken.EndObject, reader.TokenType); @@ -1380,57 +1388,70 @@ namespace Newtonsoft.Json.Tests [Test] public void ReadAsInt32() { - JsonSchema s = new JsonSchemaGenerator().Generate(typeof(int)); + JsonSchema s = new JsonSchemaGenerator().Generate(typeof (int)); JsonReader reader = new JsonValidatingReader(new JsonTextReader(new StringReader(@"1"))) - { - Schema = s - }; + { + Schema = s + }; int? i = reader.ReadAsInt32(); Assert.AreEqual(1, i); } [Test] - [ExpectedException(typeof(JsonSchemaException), ExpectedMessage = "Integer 5 exceeds maximum value of 2. Line 1, position 1.")] + [ExpectedException(typeof (JsonSchemaException), ExpectedMessage = "Integer 5 exceeds maximum value of 2. Line 1, position 1.")] public void ReadAsInt32Failure() { - JsonSchema s = new JsonSchemaGenerator().Generate(typeof(int)); + JsonSchema s = new JsonSchemaGenerator().Generate(typeof (int)); s.Maximum = 2; JsonReader reader = new JsonValidatingReader(new JsonTextReader(new StringReader(@"5"))) - { - Schema = s - }; + { + Schema = s + }; reader.ReadAsInt32(); } [Test] public void ReadAsDecimal() { - JsonSchema s = new JsonSchemaGenerator().Generate(typeof(decimal)); + JsonSchema s = new JsonSchemaGenerator().Generate(typeof (decimal)); JsonReader reader = new JsonValidatingReader(new JsonTextReader(new StringReader(@"1.5"))) - { - Schema = s - }; + { + Schema = s + }; decimal? d = reader.ReadAsDecimal(); Assert.AreEqual(1.5, d); } [Test] - [ExpectedException(typeof(JsonSchemaException), ExpectedMessage = "Float 5.5 is not evenly divisible by 1. Line 1, position 3.")] + [ExpectedException(typeof (JsonSchemaException), ExpectedMessage = "Float 5.5 is not evenly divisible by 1. Line 1, position 3.")] public void ReadAsDecimalFailure() { - JsonSchema s = new JsonSchemaGenerator().Generate(typeof(decimal)); + JsonSchema s = new JsonSchemaGenerator().Generate(typeof (decimal)); s.DivisibleBy = 1; JsonReader reader = new JsonValidatingReader(new JsonTextReader(new StringReader(@"5.5"))) - { - Schema = s - }; + { + Schema = s + }; reader.ReadAsDecimal(); } + + [Test] + public void ReadAsInt32FromSerializer() + { + JsonValidatingReader reader = new JsonValidatingReader(new JsonTextReader(new StringReader("[1,2,3]"))); + reader.Schema = new JsonSchemaGenerator().Generate(typeof(int[])); + int[] values = new JsonSerializer().Deserialize(reader); + + Assert.AreEqual(3, values.Length); + Assert.AreEqual(1, values[0]); + Assert.AreEqual(2, values[1]); + Assert.AreEqual(3, values[2]); + } } } \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs index d1e339ee..6c451eb5 100644 --- a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs @@ -72,5 +72,5 @@ using System.Security; // by using the '*' as shown below: [assembly: AssemblyVersion("4.0.8.0")] #if !PocketPC -[assembly: AssemblyFileVersion("4.0.8.14611")] +[assembly: AssemblyFileVersion("4.0.8.14618")] #endif diff --git a/Src/Newtonsoft.Json/Bson/BsonReader.cs b/Src/Newtonsoft.Json/Bson/BsonReader.cs index 061587bd..5d377a77 100644 --- a/Src/Newtonsoft.Json/Bson/BsonReader.cs +++ b/Src/Newtonsoft.Json/Bson/BsonReader.cs @@ -176,7 +176,7 @@ namespace Newtonsoft.Json.Bson /// Reads the next JSON token from the stream as a . /// /// - /// A or a null reference if the next JSON token is null. + /// A or a null reference if the next JSON token is null. This method will return null at the end of an array. /// public override byte[] ReadAsBytes() { @@ -195,7 +195,7 @@ namespace Newtonsoft.Json.Bson if (TokenType == JsonToken.Bytes) return (byte[])Value; - if (ReaderIsSerializerInArray()) + if (TokenType == JsonToken.EndArray) return null; throw CreateReaderException(this, "Error reading bytes. Expected bytes but got {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType)); @@ -228,7 +228,7 @@ namespace Newtonsoft.Json.Bson /// /// Reads the next JSON token from the stream as a . /// - /// A . + /// A . This method will return null at the end of an array. public override decimal? ReadAsDecimal() { Read(); @@ -256,7 +256,7 @@ namespace Newtonsoft.Json.Bson } } - if (ReaderIsSerializerInArray()) + if (TokenType == JsonToken.EndArray) return null; throw CreateReaderException(this, "Error reading decimal. Expected a number but got {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType)); @@ -265,7 +265,7 @@ namespace Newtonsoft.Json.Bson /// /// Reads the next JSON token from the stream as a . /// - /// A . + /// A . This method will return null at the end of an array. public override int? ReadAsInt32() { Read(); @@ -293,7 +293,7 @@ namespace Newtonsoft.Json.Bson } } - if (ReaderIsSerializerInArray()) + if (TokenType == JsonToken.EndArray) return null; throw CreateReaderException(this, "Error reading integer. Expected a number but got {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType)); @@ -304,7 +304,7 @@ namespace Newtonsoft.Json.Bson /// Reads the next JSON token from the stream as a . /// /// - /// A . + /// A . This method will return null at the end of an array. /// public override DateTimeOffset? ReadAsDateTimeOffset() { @@ -333,7 +333,7 @@ namespace Newtonsoft.Json.Bson } } - if (ReaderIsSerializerInArray()) + if (TokenType == JsonToken.EndArray) return null; throw CreateReaderException(this, "Error reading date. Expected date but got {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType)); diff --git a/Src/Newtonsoft.Json/JsonReader.cs b/Src/Newtonsoft.Json/JsonReader.cs index 8478c8c9..6d80c6e1 100644 --- a/Src/Newtonsoft.Json/JsonReader.cs +++ b/Src/Newtonsoft.Json/JsonReader.cs @@ -102,14 +102,8 @@ namespace Newtonsoft.Json private char _quoteChar; internal State _currentState; private JTokenType _currentTypeContext; - private bool _serializerInArray; private CultureInfo _culture; - internal void SetSerializeInArray(bool serializerInArray) - { - _serializerInArray = serializerInArray; - } - /// /// Gets the current reader state. /// @@ -235,26 +229,26 @@ namespace Newtonsoft.Json /// /// Reads the next JSON token from the stream as a . /// - /// A . + /// A . This method will return null at the end of an array. public abstract int? ReadAsInt32(); /// /// Reads the next JSON token from the stream as a . /// - /// A or a null reference if the next JSON token is null. + /// A or a null reference if the next JSON token is null. This method will return null at the end of an array. public abstract byte[] ReadAsBytes(); /// /// Reads the next JSON token from the stream as a . /// - /// A . + /// A . This method will return null at the end of an array. public abstract decimal? ReadAsDecimal(); #if !NET20 /// /// Reads the next JSON token from the stream as a . /// - /// A . + /// A . This method will return null at the end of an array. public abstract DateTimeOffset? ReadAsDateTimeOffset(); #endif @@ -434,11 +428,6 @@ namespace Newtonsoft.Json } } - internal bool ReaderIsSerializerInArray() - { - return (TokenType == JsonToken.EndArray && _serializerInArray); - } - /// /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// diff --git a/Src/Newtonsoft.Json/JsonTextReader.cs b/Src/Newtonsoft.Json/JsonTextReader.cs index 3da8fb13..64cacfd8 100644 --- a/Src/Newtonsoft.Json/JsonTextReader.cs +++ b/Src/Newtonsoft.Json/JsonTextReader.cs @@ -362,7 +362,7 @@ namespace Newtonsoft.Json /// Reads the next JSON token from the stream as a . /// /// - /// A or a null reference if the next JSON token is null. + /// A or a null reference if the next JSON token is null. This method will return null at the end of an array. /// public override byte[] ReadAsBytes() { @@ -414,7 +414,7 @@ namespace Newtonsoft.Json throw CreateReaderException(this, "Unexpected end when reading bytes."); } - if (ReaderIsSerializerInArray()) + if (TokenType == JsonToken.EndArray) return null; throw CreateReaderException(this, "Unexpected token when reading bytes: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType)); @@ -423,7 +423,7 @@ namespace Newtonsoft.Json /// /// Reads the next JSON token from the stream as a . /// - /// A . + /// A . This method will return null at the end of an array. public override decimal? ReadAsDecimal() { _readType = ReadType.ReadAsDecimal; @@ -454,7 +454,7 @@ namespace Newtonsoft.Json } } - if (ReaderIsSerializerInArray()) + if (TokenType == JsonToken.EndArray) return null; throw CreateReaderException(this, "Unexpected token when reading decimal: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType)); @@ -463,7 +463,7 @@ namespace Newtonsoft.Json /// /// Reads the next JSON token from the stream as a . /// - /// A . + /// A . This method will return null at the end of an array. public override int? ReadAsInt32() { _readType = ReadType.ReadAsInt32; @@ -494,7 +494,7 @@ namespace Newtonsoft.Json } } - if (ReaderIsSerializerInArray()) + if (TokenType == JsonToken.EndArray) return null; throw CreateReaderException(this, "Unexpected token when reading integer: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType)); @@ -504,7 +504,7 @@ namespace Newtonsoft.Json /// /// Reads the next JSON token from the stream as a . /// - /// A . + /// A . This method will return null at the end of an array. public override DateTimeOffset? ReadAsDateTimeOffset() { _readType = ReadType.ReadAsDateTimeOffset; @@ -535,7 +535,7 @@ namespace Newtonsoft.Json } } - if (ReaderIsSerializerInArray()) + if (TokenType == JsonToken.EndArray) return null; throw CreateReaderException(this, "Unexpected token when reading date: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType)); @@ -1270,7 +1270,10 @@ namespace Newtonsoft.Json JsonToken numberType; bool singleDigit = (char.IsDigit(firstChar) && _stringReference.Length == 1); - bool nonBase10 = (firstChar == '0' && _stringReference.Length > 1 && _stringReference.Chars[_stringReference.StartIndex + 1] != '.'); + bool nonBase10 = (firstChar == '0' && _stringReference.Length > 1 + && _stringReference.Chars[_stringReference.StartIndex + 1] != '.' + && _stringReference.Chars[_stringReference.StartIndex + 1] != 'e' + && _stringReference.Chars[_stringReference.StartIndex + 1] != 'E'); if (_readType == ReadType.ReadAsInt32) { diff --git a/Src/Newtonsoft.Json/Linq/JTokenReader.cs b/Src/Newtonsoft.Json/Linq/JTokenReader.cs index 704a804a..bb003418 100644 --- a/Src/Newtonsoft.Json/Linq/JTokenReader.cs +++ b/Src/Newtonsoft.Json/Linq/JTokenReader.cs @@ -32,7 +32,7 @@ namespace Newtonsoft.Json.Linq /// Reads the next JSON token from the stream as a . /// /// - /// A or a null reference if the next JSON token is null. + /// A or a null reference if the next JSON token is null. This method will return null at the end of an array. /// public override byte[] ReadAsBytes() { @@ -59,7 +59,7 @@ namespace Newtonsoft.Json.Linq if (TokenType == JsonToken.Bytes) return (byte[])Value; - if (ReaderIsSerializerInArray()) + if (TokenType == JsonToken.EndArray) return null; throw CreateReaderException(this, "Error reading bytes. Expected bytes but got {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType)); @@ -92,7 +92,7 @@ namespace Newtonsoft.Json.Linq /// /// Reads the next JSON token from the stream as a . /// - /// A . + /// A . This method will return null at the end of an array. public override decimal? ReadAsDecimal() { Read(); @@ -120,7 +120,7 @@ namespace Newtonsoft.Json.Linq } } - if (ReaderIsSerializerInArray()) + if (TokenType == JsonToken.EndArray) return null; throw CreateReaderException(this, "Error reading decimal. Expected a number but got {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType)); @@ -129,7 +129,7 @@ namespace Newtonsoft.Json.Linq /// /// Reads the next JSON token from the stream as a . /// - /// A . + /// A . This method will return null at the end of an array. public override int? ReadAsInt32() { Read(); @@ -157,7 +157,7 @@ namespace Newtonsoft.Json.Linq } } - if (ReaderIsSerializerInArray()) + if (TokenType == JsonToken.EndArray) return null; throw CreateReaderException(this, "Error reading integer. Expected a number but got {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType)); @@ -167,7 +167,7 @@ namespace Newtonsoft.Json.Linq /// /// Reads the next JSON token from the stream as a . /// - /// A . + /// A . This method will return null at the end of an array. public override DateTimeOffset? ReadAsDateTimeOffset() { Read(); @@ -194,8 +194,8 @@ namespace Newtonsoft.Json.Linq throw CreateReaderException(this, "Could not convert string to DateTimeOffset: {0}.".FormatWith(CultureInfo.InvariantCulture, Value)); } } - - if (ReaderIsSerializerInArray()) + + if (TokenType == JsonToken.EndArray) return null; throw CreateReaderException(this, "Error reading date. Expected date but got {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType)); diff --git a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs index 86c838f0..8256f4f3 100644 --- a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs @@ -85,7 +85,7 @@ using System.Security; // by using the '*' as shown below: [assembly: AssemblyVersion("4.0.8.0")] #if !PocketPC -[assembly: AssemblyFileVersion("4.0.8.14611")] +[assembly: AssemblyFileVersion("4.0.8.14618")] #endif [assembly: CLSCompliant(true)] diff --git a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs index 3d332738..96a3d5dc 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs @@ -1093,12 +1093,6 @@ namespace Newtonsoft.Json.Serialization return propertyValues; } - private void SetSerializeInArray(JsonReader reader, bool inArray, bool enable) - { - if (inArray) - reader.SetSerializeInArray(enable); - } - private bool ReadForType(JsonReader reader, JsonContract contract, bool hasConverter, bool inArray) { // don't read properties with converters as a specific value @@ -1119,29 +1113,17 @@ namespace Newtonsoft.Json.Serialization return true; case ReadType.ReadAsInt32: - SetSerializeInArray(reader, inArray, true); reader.ReadAsInt32(); - SetSerializeInArray(reader, inArray, false); - return true; case ReadType.ReadAsDecimal: - SetSerializeInArray(reader, inArray, true); reader.ReadAsDecimal(); - SetSerializeInArray(reader, inArray, false); - return true; case ReadType.ReadAsBytes: - SetSerializeInArray(reader, inArray, true); reader.ReadAsBytes(); - SetSerializeInArray(reader, inArray, false); - return true; #if !NET20 case ReadType.ReadAsDateTimeOffset: - SetSerializeInArray(reader, inArray, true); reader.ReadAsDateTimeOffset(); - SetSerializeInArray(reader, inArray, false); - return true; #endif default: