Newtonsoft.Json.JsonWriter.WriteWhitespace C# (CSharp) Method

WriteWhitespace() public method

Writes the given white space.
public WriteWhitespace ( string ws ) : void
ws string The string of white space characters.
return void
        public virtual void WriteWhitespace(string ws)
        {
            InternalWriteWhitespace(ws);
        }

Usage Example

Beispiel #1
0
        /// <summary>
        /// Writes this token to a <see cref="JsonWriter"/>.
        /// </summary>
        /// <param name="writer">A <see cref="JsonWriter"/> into which this method will write.</param>
        /// <param name="converters">A collection of <see cref="JsonConverter"/> which will be used when writing the token.</param>
        public override void WriteTo(JsonWriter writer, params JsonConverter[] converters) {
            writer.WriteStartObject();
            if (this.WithComment) {
                var lPath = writer.Path;
                var lState = writer.WriteState;
                StringBuilder lComments = new StringBuilder();
                int lLevel = (lPath.Split('.').Length + 1) * 2;
                if (lPath == "") lLevel = 2;
                writer.WriteWhitespace("\r\n");
                for (int lCount = 0; lCount < mComment.Count; lCount++) {
                    if (lLevel > 0) writer.WriteWhitespace(new string(' ', lLevel));
                    writer.WriteRaw("//" + mComment[lCount]);
                    if (lCount + 1 < mComment.Count) writer.WriteWhitespace("\r\n");
                }
            }
            var _properties = base.Properties();
            foreach (var lProperty in _properties) {
                lProperty.WriteTo(writer, converters);
            }
            writer.WriteEndObject();


            //base.WriteTo(writer, converters);
        }
All Usage Examples Of Newtonsoft.Json.JsonWriter::WriteWhitespace