internal override void ToString(FormatContext format, StringBuilder builder) { builder.Append("["); FormatContext indented = format.Indented(); if (elements.Length > 0) { indented.OptionalNewline(builder); } for (int i = 0; i < elements.Length; i++) { elements[i].ToString(indented, builder); if (i != elements.Length - 1) { builder.Append(","); } if (i < elements.Length - 1) { indented.OptionalNewline(builder); } } if (elements.Length > 0) { format.OptionalNewline(builder); } builder.Append("]"); }
internal override void ToString(FormatContext format, StringBuilder builder) { builder.Append("{"); var indented = format.Indented(); foreach (KeyValuePair <string, JToken> entry in this.values) { indented.OptionalNewline(builder); builder.Append("\""); builder.Append(entry.Key); builder.Append("\""); indented.OptionalWhitespace(builder); builder.Append(":"); indented.OptionalWhitespace(builder); entry.Value.ToString(indented, builder); builder.Append(","); } if (this.values.Count > 0) { // Remove the last comma builder.Remove(builder.Length - 1, 1); } format.OptionalNewline(builder); builder.Append("}"); }