-Fixed deserializing a null string throwing a NullReferenceException

-Fixed JsonTextReader reading from a slow stream
-Fixed CultureInfo not being overridden on JsonSerializerProxy
-Fixed full trust security check in .NET 2.0 & .NET 3.5
-Improved writing JSON with indent performance
This commit is contained in:
James Newton-King
2012-03-31 14:30:14 +13:00
parent 8471c4ffe1
commit a032f4bbf3
12 changed files with 300 additions and 178 deletions
+7 -2
View File
@@ -221,9 +221,14 @@ namespace Newtonsoft.Json
// levels of indentation multiplied by the indent count
int currentIndentCount = Top*_indentation;
for (int i = 0; i < currentIndentCount; i++)
while (currentIndentCount > 0)
{
_writer.Write(_indentChar);
// write up to a max of 10 characters at once to avoid creating too many new strings
int writeCount = Math.Min(currentIndentCount, 10);
_writer.Write(new string(_indentChar, writeCount));
currentIndentCount -= writeCount;
}
}