aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf/WellKnownTypes
diff options
context:
space:
mode:
authorGravatar avgweb <agv@cox.net>2016-03-06 17:50:02 -0800
committerGravatar avgweb <agv@cox.net>2016-03-06 17:50:02 -0800
commitad2d775e1b8d56477d0ab39b6148c361766c91f1 (patch)
tree134dbc222ab9d13bcbfbf8ac5c637856005aa09e /csharp/src/Google.Protobuf/WellKnownTypes
parent9242d9b7f431e40d119faef8b583d945362ef04c (diff)
Replace StringBuilder with TextWriter in JsonFormatter
Diffstat (limited to 'csharp/src/Google.Protobuf/WellKnownTypes')
-rw-r--r--csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs17
1 files changed, 9 insertions, 8 deletions
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs
index df1292dc..4bd62cf3 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs
@@ -33,6 +33,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Text;
@@ -57,19 +58,19 @@ namespace Google.Protobuf.WellKnownTypes
var firstInvalid = paths.FirstOrDefault(p => !ValidatePath(p));
if (firstInvalid == null)
{
- var builder = new StringBuilder();
- JsonFormatter.WriteString(builder, string.Join(",", paths.Select(JsonFormatter.ToCamelCase)));
- return builder.ToString();
+ var writer = new StringWriter();
+ JsonFormatter.WriteString(writer, string.Join(",", paths.Select(JsonFormatter.ToCamelCase)));
+ return writer.ToString();
}
else
{
if (diagnosticOnly)
{
- var builder = new StringBuilder();
- builder.Append("{ \"@warning\": \"Invalid FieldMask\", \"paths\": ");
- JsonFormatter.Default.WriteList(builder, (IList) paths);
- builder.Append(" }");
- return builder.ToString();
+ var writer = new StringWriter();
+ writer.Write("{ \"@warning\": \"Invalid FieldMask\", \"paths\": ");
+ JsonFormatter.Default.WriteList(writer, (IList)paths);
+ writer.Write(" }");
+ return writer.ToString();
}
else
{