public void Write(string value) { if (value == null) { throw new ArgumentNullException("value"); } this.WriteFormatting(JsonToken.StringLiteral); var len = value.Length; var offset = 0; outputBuffer[0] = '"'; this.WriteJson(outputBuffer, 0, 1); while (offset < len) { var writtenInBuffer = JsonUtils.EscapeBuffer(value, ref offset, outputBuffer, 0); this.WriteJson(outputBuffer, 0, writtenInBuffer); } outputBuffer[0] = '"'; this.WriteJson(outputBuffer, 0, 1); }
public void Write(string value) { if (value == null) { this.WriteNull(); return; } this.WriteFormatting(JsonToken.StringLiteral); var len = value.Length; var offset = 0; this.buffer[0] = '"'; this.WriteJson(this.buffer, 0, 1); while (offset < len) { var writtenInBuffer = JsonUtils.EscapeBuffer(value, ref offset, this.buffer, 0); this.WriteJson(this.buffer, 0, writtenInBuffer); } this.buffer[0] = '"'; this.WriteJson(this.buffer, 0, 1); }